diff options
Diffstat (limited to 'awwan_env_test.go')
| -rw-r--r-- | awwan_env_test.go | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/awwan_env_test.go b/awwan_env_test.go index ce386c9..fdefec0 100644 --- a/awwan_env_test.go +++ b/awwan_env_test.go @@ -164,6 +164,11 @@ func TestAwwanEnvSet(t *testing.T) { var file = filepath.Join(baseDir, `awwan.env`) var cases = []testCase{{ + desc: `withEmptyFile`, + key: `host::ip_internal`, + val: `127.0.0.1`, + exp: string(tdata.Output[`withEmptyFile:error`]), + }, { desc: `withEmptyKey`, file: file, exp: string(tdata.Output[`withEmptyKey:error`]), @@ -191,16 +196,17 @@ func TestAwwanEnvSet(t *testing.T) { val: `awwan`, exp: string(tdata.Output[`withFileNotExist`]), }, { - desc: `withEmptyFile`, - key: `host::ip_internal`, - val: `127.0.0.1`, - exp: string(tdata.Output[`withEmptyFile`]), - }, { desc: `withOverwriteValue`, file: file, key: `host::name`, val: `overwrite`, exp: string(tdata.Output[`withOverwriteValue`]), + }, { + desc: `withQuotedString`, + file: file, + key: `"host:my:name"`, + val: `my-host`, + exp: string(tdata.Output[`withQuotedString`]), }} var ( @@ -210,17 +216,13 @@ func TestAwwanEnvSet(t *testing.T) { ) for _, c = range cases { - err = aww.EnvSet(c.key, c.val, c.file) + err = aww.EnvSet(c.file, c.key, c.val) if err != nil { test.Assert(t, c.desc, c.exp, err.Error()) continue } - if len(c.file) == 0 { - gotContent, err = os.ReadFile(file) - } else { - gotContent, err = os.ReadFile(c.file) - } + gotContent, err = os.ReadFile(c.file) if err != nil { t.Fatal(err) } |
