github.com/ranjib/nomad@v0.1.1-0.20160225204057-97751b02f70b/command/helpers_test.go (about) 1 package command 2 3 import ( 4 "testing" 5 ) 6 7 func TestHelpers_FormatKV(t *testing.T) { 8 in := []string{"alpha|beta", "charlie|delta", "echo|"} 9 out := formatKV(in) 10 11 expect := "alpha = beta\n" 12 expect += "charlie = delta\n" 13 expect += "echo = <none>" 14 15 if out != expect { 16 t.Fatalf("expect: %s, got: %s", expect, out) 17 } 18 } 19 20 func TestHelpers_FormatList(t *testing.T) { 21 in := []string{"alpha|beta||delta"} 22 out := formatList(in) 23 24 expect := "alpha beta <none> delta" 25 26 if out != expect { 27 t.Fatalf("expect: %s, got: %s", expect, out) 28 } 29 }