2015-09-15 23:44:38 +00:00
|
|
|
package command
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestHelpers_FormatKV(t *testing.T) {
|
2015-09-27 21:04:53 +00:00
|
|
|
in := []string{"alpha|beta", "charlie|delta", "echo|"}
|
2015-09-15 23:44:38 +00:00
|
|
|
out := formatKV(in)
|
|
|
|
|
|
|
|
expect := "alpha = beta\n"
|
2015-09-27 21:04:53 +00:00
|
|
|
expect += "charlie = delta\n"
|
|
|
|
expect += "echo = <none>"
|
2015-09-15 23:44:38 +00:00
|
|
|
|
|
|
|
if out != expect {
|
|
|
|
t.Fatalf("expect: %s, got: %s", expect, out)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestHelpers_FormatList(t *testing.T) {
|
|
|
|
in := []string{"alpha|beta||delta"}
|
|
|
|
out := formatList(in)
|
|
|
|
|
|
|
|
expect := "alpha beta <none> delta"
|
|
|
|
|
|
|
|
if out != expect {
|
|
|
|
t.Fatalf("expect: %s, got: %s", expect, out)
|
|
|
|
}
|
|
|
|
}
|