2
2
mirror of https://github.com/octoleo/restic.git synced 2024-11-30 08:44:02 +00:00
restic/internal/feature/testing_test.go

20 lines
525 B
Go
Raw Normal View History

2024-02-12 20:34:37 +00:00
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")
}