mirror of https://github.com/docker/cli.git
add test for zero length variable name
parsing an environment file should give an error in case a zero-length variable name (definition w/o a variable name) is encountered. previously these lines went through unnoticed not informing the user about a potential configuration error. Signed-off-by: Tom Klingenberg <tklingenberg@lastflood.net>
This commit is contained in:
parent
96c026eb30
commit
b91fd12996
|
@ -162,3 +162,17 @@ HOME
|
|||
t.Fatal("exactly one variable is imported (as the other one is not set at all)")
|
||||
}
|
||||
}
|
||||
|
||||
// ParseEnvFile with empty variable name
|
||||
func TestParseEnvVariableWithNoNameFile(t *testing.T) {
|
||||
content := `# comment=
|
||||
=blank variable names are an error case
|
||||
`
|
||||
tmpFile := tmpFileWithContent(content, t)
|
||||
defer os.Remove(tmpFile)
|
||||
|
||||
_, err := ParseEnvFile(tmpFile)
|
||||
if nil == err {
|
||||
t.Fatal("if a variable has no name parsing an environment file must fail")
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue