Add quote function in template

Co-authored-by: Charle Demers <charle.demers@gmail.com>
This commit is contained in:
Pierrick Charron 2019-08-09 15:47:29 -04:00
parent 8c472190d1
commit f459515d0d
4 changed files with 50 additions and 18 deletions

View file

@ -231,6 +231,21 @@ func TestFormatIP(t *testing.T) {
}
}
func TestQuote(t *testing.T) {
cases := map[interface{}]string{
"foo": `"foo"`,
"\"foo\"": `"\"foo\""`,
"foo\nbar": `"foo\nbar"`,
10: `"10"`,
}
for input, output := range cases {
actual := quote(input)
if actual != output {
t.Errorf("quote('%s'): expected '%v' but returned '%v'", input, output, actual)
}
}
}
func TestBuildLocation(t *testing.T) {
invalidType := &ingress.Ingress{}
expected := "/"