1
2
3
4
5 package fips140
6
7 import (
8 "internal/godebug"
9 "internal/testenv"
10 "testing"
11 )
12
13 func TestImmutableGODEBUG(t *testing.T) {
14 fips140Enabled := Enabled()
15 fips140Setting := godebug.New("fips140")
16 fips140SettingValue := fips140Setting.Value()
17
18 tests := []string{
19 "fips140=off",
20 "fips140=on",
21 "fips140=",
22 "",
23 }
24 for _, godebugValue := range tests {
25 t.Run(godebugValue, func(t *testing.T) {
26 testenv.SetGODEBUG(t, godebugValue)
27 if Enabled() != fips140Enabled {
28 t.Errorf("Enabled() changed after setting GODEBUG=%s", godebugValue)
29 }
30 if fips140Setting.Value() != fips140SettingValue {
31 t.Errorf("fips140Setting.Value() changed after setting GODEBUG=%s", godebugValue)
32 }
33 })
34 }
35 }
36
View as plain text