2017-04-29 17:03:45 +00:00
|
|
|
package internal
|
2016-07-27 21:11:54 +00:00
|
|
|
|
|
|
|
import "testing"
|
|
|
|
|
2017-04-29 17:03:45 +00:00
|
|
|
func TestParseKeyPair(t *testing.T) {
|
2016-07-27 21:11:54 +00:00
|
|
|
s := []string{"FOO=bar", "BAR=", "INVALID"}
|
2017-04-29 17:03:45 +00:00
|
|
|
p := ParseKeyPair(s)
|
2016-07-27 21:11:54 +00:00
|
|
|
if p["FOO"] != "bar" {
|
|
|
|
t.Errorf("Wanted %q, got %q.", "bar", p["FOO"])
|
|
|
|
}
|
|
|
|
if _, exists := p["BAR"]; !exists {
|
|
|
|
t.Error("Missing a key with no value. Keys with empty values are also valid.")
|
|
|
|
}
|
|
|
|
if _, exists := p["INVALID"]; exists {
|
|
|
|
t.Error("Keys without an equal sign suffix are invalid.")
|
|
|
|
}
|
|
|
|
}
|