features: add tests
This commit is contained in:
parent
1c77c51a03
commit
70839155f2
2 changed files with 158 additions and 0 deletions
19
internal/feature/testing_test.go
Normal file
19
internal/feature/testing_test.go
Normal file
|
@ -0,0 +1,19 @@
|
|||
package feature_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/restic/restic/internal/feature"
|
||||
rtest "github.com/restic/restic/internal/test"
|
||||
)
|
||||
|
||||
func TestSetFeatureFlag(t *testing.T) {
|
||||
flags := buildTestFlagSet()
|
||||
rtest.Assert(t, !flags.Enabled(alpha), "expected alpha feature to be disabled")
|
||||
|
||||
restore := feature.TestSetFlag(t, flags, alpha, true)
|
||||
rtest.Assert(t, flags.Enabled(alpha), "expected alpha feature to be enabled")
|
||||
|
||||
restore()
|
||||
rtest.Assert(t, !flags.Enabled(alpha), "expected alpha feature to be disabled again")
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue