1
0
mirror of https://github.com/woodpecker-ci/woodpecker.git synced 2024-12-12 08:23:48 +02:00
woodpecker/cli/internal/util_test.go
Anbraten 188b9e6eb5
Refactor cli (#329)
- move cli files from `cli/drone` to `cli/`
- move cli main to `cmd/cli/main.go` to match agent and server
- use version from `version/version.go` to match agent and server
2021-09-21 16:36:41 +02:00

21 lines
547 B
Go

package internal
import "testing"
func TestParseKeyPair(t *testing.T) {
s := []string{"FOO=bar", "BAR=", "BAZ=qux=quux", "INVALID"}
p := ParseKeyPair(s)
if p["FOO"] != "bar" {
t.Errorf("Wanted %q, got %q.", "bar", p["FOO"])
}
if p["BAZ"] != "qux=quux" {
t.Errorf("Wanted %q, got %q.", "qux=quux", p["BAZ"])
}
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.")
}
}