summaryrefslogtreecommitdiff
path: root/tests/matrix
diff options
context:
space:
mode:
authorJakob Unterwurzacher2016-10-08 19:18:56 +0200
committerJakob Unterwurzacher2016-10-08 19:18:56 +0200
commit29c8ca85d836f560837b0be51114b7a2931cf5bd (patch)
tree1c8c2a352178d962ed8be27debe2e71f95589f5c /tests/matrix
parent084cd597abfc76e25b5c7be238362f53cfb5cb83 (diff)
tests: matrix: have the testcase struct as a global variable
Future tests will need more info about the running test case.
Diffstat (limited to 'tests/matrix')
-rw-r--r--tests/matrix/matrix_test.go20
1 files changed, 10 insertions, 10 deletions
diff --git a/tests/matrix/matrix_test.go b/tests/matrix/matrix_test.go
index 99ac257..77d9dc7 100644
--- a/tests/matrix/matrix_test.go
+++ b/tests/matrix/matrix_test.go
@@ -30,7 +30,7 @@ import (
// Several tests need to be aware if plaintextnames is active or not, so make this
// a global variable
-var plaintextnames bool
+var testcase testcaseMatrix
type testcaseMatrix struct {
// Exported so we can dump the struct using json.Marshal
@@ -56,7 +56,7 @@ var matrix []testcaseMatrix = []testcaseMatrix{
func TestMain(m *testing.M) {
// Make "testing.Verbose()" return the correct value
flag.Parse()
- for _, testcase := range matrix {
+ for _, testcase = range matrix {
if !cryptocore.HaveModernGoGCM && testcase.Openssl != "true" {
fmt.Printf("Skipping Go GCM variant, Go installation is too old")
continue
@@ -65,8 +65,8 @@ func TestMain(m *testing.M) {
j, _ := json.Marshal(testcase)
fmt.Printf("matrix: testcase = %s\n", string(j))
}
- plaintextnames = testcase.Plaintextnames
- test_helpers.ResetTmpDir(plaintextnames)
+ testcase.Plaintextnames = testcase.Plaintextnames
+ test_helpers.ResetTmpDir(testcase.Plaintextnames)
opts := []string{"-zerokey"}
opts = append(opts, fmt.Sprintf("-openssl=%v", testcase.Openssl))
opts = append(opts, fmt.Sprintf("-plaintextnames=%v", testcase.Plaintextnames))
@@ -474,17 +474,17 @@ func TestRmwRace(t *testing.T) {
func TestFiltered(t *testing.T) {
filteredFile := test_helpers.DefaultPlainDir + "/gocryptfs.conf"
file, err := os.Create(filteredFile)
- if plaintextnames && err == nil {
+ if testcase.Plaintextnames && err == nil {
t.Errorf("should have failed but didn't")
- } else if !plaintextnames && err != nil {
+ } else if !testcase.Plaintextnames && err != nil {
t.Error(err)
}
file.Close()
err = os.Remove(filteredFile)
- if plaintextnames && err == nil {
+ if testcase.Plaintextnames && err == nil {
t.Errorf("should have failed but didn't")
- } else if !plaintextnames && err != nil {
+ } else if !testcase.Plaintextnames && err != nil {
t.Error(err)
}
}
@@ -496,9 +496,9 @@ func TestFilenameEncryption(t *testing.T) {
t.Fatal(err)
}
_, err = os.Stat(test_helpers.DefaultCipherDir + "/TestFilenameEncryption.txt")
- if plaintextnames && err != nil {
+ if testcase.Plaintextnames && err != nil {
t.Errorf("plaintextnames not working: %v", err)
- } else if !plaintextnames && err == nil {
+ } else if !testcase.Plaintextnames && err == nil {
t.Errorf("file name encryption not working")
}
}