mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-11-30 08:06:52 +02:00
18 lines
441 B
Go
18 lines
441 B
Go
|
package main
|
||
|
|
||
|
import "testing"
|
||
|
|
||
|
func Test_parseKVPairs(t *testing.T) {
|
||
|
s := []string{"FOO=bar", "BAR=", "INVALID"}
|
||
|
p := parseKVPairs(s)
|
||
|
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.")
|
||
|
}
|
||
|
}
|