summaryrefslogtreecommitdiff
path: root/flag_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'flag_test.go')
-rw-r--r--flag_test.go21
1 files changed, 21 insertions, 0 deletions
diff --git a/flag_test.go b/flag_test.go
index 91c6caa..1cc9ba8 100644
--- a/flag_test.go
+++ b/flag_test.go
@@ -11,6 +11,18 @@ import (
"go.awhk.org/core"
)
+func TestFeature_Disable(t *testing.T) {
+ f := core.Feature{}
+ f.Disable()
+ (&core.T{T: t}).AssertEqual(false, f.Enabled())
+}
+
+func TestFeature_Enable(t *testing.T) {
+ f := core.Feature{}
+ f.Enable()
+ (&core.T{T: t}).AssertEqual(true, f.Enabled())
+}
+
func TestFlag(s *testing.T) {
t := core.T{T: s}
@@ -21,6 +33,15 @@ func TestFlag(s *testing.T) {
t.AssertEqual(84, *fl)
}
+func TestFlagFeature(s *testing.T) {
+ t := core.T{T: s}
+
+ fs := flag.NewFlagSet("", flag.PanicOnError)
+ ff := core.FlagFeature(fs, "some-feature", false, "")
+ t.AssertErrorIs(nil, fs.Parse([]string{"-some-feature"}))
+ t.AssertEqual(true, ff.Enabled())
+}
+
func TestFlagVar(s *testing.T) {
t := core.T{T: s}