input Getenvs to FlagXYZ

This commit is contained in:
bel
2023-03-25 10:58:13 -06:00
parent ae1e32391c
commit a1a12b1873
9 changed files with 45 additions and 20 deletions

View File

@@ -3,6 +3,7 @@ package input_test
import (
"context"
"mayhem-party/src/device/input"
"mayhem-party/src/device/input/raw"
"mayhem-party/src/device/input/wrap"
"os"
"path"
@@ -32,10 +33,10 @@ func TestNewRemapped(t *testing.T) {
}
wrap.FlagRemapFile = remap
os.Setenv("RAW_RANDOM_WEIGHT_FILE", rand)
raw.FlagRawRandomWeightFile = rand
t.Cleanup(func() {
wrap.FlagRemapFile = ""
os.Unsetenv("RAW_RANDOM_WEIGHT_FILE")
raw.FlagRawRandomWeightFile = ""
})
r := input.New(context.Background())
@@ -72,9 +73,9 @@ func TestNewRandomWeightFile(t *testing.T) {
t.Fatal(err)
}
os.Setenv("RAW_RANDOM_WEIGHT_FILE", p)
raw.FlagRawRandomWeightFile = p
t.Cleanup(func() {
os.Unsetenv("RAW_RANDOM_WEIGHT_FILE")
raw.FlagRawRandomWeightFile = ""
})
r := input.New(context.Background())