forked from adamlaska/boulder
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfeatures_test.go
More file actions
32 lines (25 loc) · 818 Bytes
/
features_test.go
File metadata and controls
32 lines (25 loc) · 818 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package features
import (
"testing"
"github.com/letsencrypt/boulder/test"
)
func TestFeatures(t *testing.T) {
features = map[FeatureFlag]bool{
unused: false,
}
test.Assert(t, !Enabled(unused), "'unused' shouldn't be enabled")
err := Set(map[string]bool{"unused": true})
test.AssertNotError(t, err, "Set shouldn't have failed setting existing features")
test.Assert(t, Enabled(unused), "'unused' should be enabled")
Reset()
test.Assert(t, !Enabled(unused), "'unused' shouldn't be enabled")
err = Set(map[string]bool{"non-existent": true})
test.AssertError(t, err, "Set should've failed trying to enable a non-existent feature")
defer func() {
if r := recover(); r == nil {
t.Errorf("Enabled did not panic on an unknown feature")
}
}()
features = map[FeatureFlag]bool{}
Enabled(unused)
}