tpl: Add missing test variants for slicestr
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Sun, 7 Feb 2016 19:14:24 +0000 (20:14 +0100)
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Sun, 7 Feb 2016 19:14:24 +0000 (20:14 +0100)
tpl/template_funcs_test.go

index 4ad95b6d2bed9850a9483e0f1405a9e3e0aebef5..b52075218b96401dbe4b36fbf03e0dcc45f934d6 100644 (file)
@@ -499,6 +499,8 @@ func TestSlicestr(t *testing.T) {
                {"abcdef", 1, -1, false},
                {tstNoStringer{}, 0, 1, false},
                {"ĀĀĀ", 0, 1, "Ā"}, // issue #1333
+               {"a", t, nil, false},
+               {"a", 1, t, false},
        } {
                var result string
                if this.v2 == nil {
@@ -523,6 +525,12 @@ func TestSlicestr(t *testing.T) {
                        }
                }
        }
+
+       // Too many arguments
+       _, err = slicestr("a", 1, 2, 3)
+       if err == nil {
+               t.Errorf("Should have errored")
+       }
 }
 
 func TestSubstr(t *testing.T) {