summaryrefslogtreecommitdiff
path: root/internal/configfile/config_test.go
diff options
context:
space:
mode:
authorJakob Unterwurzacher2016-06-05 12:53:10 +0200
committerJakob Unterwurzacher2016-06-05 12:54:45 +0200
commitf2d208c464a1f157014127bfa97dbb7b84158f95 (patch)
tree11333ee2f932d06a6f1ce6b0f219df3d931fca5b /internal/configfile/config_test.go
parentb97268c94824b8047c8d4f97a68549260e4f6835 (diff)
configfile: use map[flagIota] for feature flags
This should make things saner and more extensible. It prepares the infrastructure for "required feature flags" that will be used to deprecate old gocryptfs version.
Diffstat (limited to 'internal/configfile/config_test.go')
-rw-r--r--internal/configfile/config_test.go23
1 files changed, 16 insertions, 7 deletions
diff --git a/internal/configfile/config_test.go b/internal/configfile/config_test.go
index c83c4bd..d0540c3 100644
--- a/internal/configfile/config_test.go
+++ b/internal/configfile/config_test.go
@@ -72,14 +72,23 @@ func TestCreateConfFile(t *testing.T) {
}
func TestIsFeatureFlagKnown(t *testing.T) {
- var cf ConfFile
- if !cf.isFeatureFlagKnown(FlagDirIV) {
- t.Errorf("This flag should be known")
+ // Test a few hardcoded values
+ testKnownFlags := []string{"DirIV", "PlaintextNames", "EMENames", "GCMIV128", "LongNames"}
+ // And also everything in knownFlags (yes, it is likely that we end up with
+ // some duplicates. Does not matter.)
+ for _, f := range knownFlags {
+ testKnownFlags = append(testKnownFlags, f)
}
- if !cf.isFeatureFlagKnown(FlagPlaintextNames) {
- t.Errorf("This flag should be known")
+
+ var cf ConfFile
+ for _, f := range testKnownFlags {
+ if !cf.isFeatureFlagKnown(f) {
+ t.Errorf("flag %q should be known", f)
+ }
}
- if cf.isFeatureFlagKnown("StrangeFeatureFlag") {
- t.Errorf("This flag should be NOT known")
+
+ f := "StrangeFeatureFlag"
+ if cf.isFeatureFlagKnown(f) {
+ t.Errorf("flag %q should be NOT known", f)
}
}