Rename Slice to Slicestr
authorbep <bjorn.erik.pedersen@gmail.com>
Mon, 23 Mar 2015 15:24:18 +0000 (16:24 +0100)
committerbep <bjorn.erik.pedersen@gmail.com>
Mon, 23 Mar 2015 15:24:15 +0000 (16:24 +0100)
Fixes #990

tpl/template.go
tpl/template_test.go

index 367703f93695b0307b8ce7595b8b092bcaf952ae..1dc19eb1d4cf7135c7062419ed1a92e7b6ad5c66 100644 (file)
@@ -188,11 +188,11 @@ func compareGetFloat(a interface{}, b interface{}) (float64, float64) {
        return left, right
 }
 
-// Slicing in Slice is done by specifying a half-open range with
+// Slicing in Slicestr is done by specifying a half-open range with
 // two indices, start and end. 1 and 4 creates a slice including elements 1 through 3.
 // The start and/or end indices can be omitted by setting one or both of them to -1;
 // they default to zero and the slice's length respectively
-func Slice(a interface{}, start, end int) (string, error) {
+func Slicestr(a interface{}, start, end int) (string, error) {
        aStr, err := cast.ToStringE(a)
        if err != nil {
                return "", err
@@ -1338,7 +1338,7 @@ func init() {
                "lt":          Lt,
                "le":          Le,
                "in":          In,
-               "slice":       Slice,
+               "slicestr":    Slicestr,
                "split":       Split,
                "intersect":   Intersect,
                "isSet":       IsSet,
index 55f739576a5368cd07519e67fab97e3d7c25468b..3ea7af9781e8994d83957add978b47bf94a2ff83 100644 (file)
@@ -276,7 +276,7 @@ func TestIn(t *testing.T) {
        }
 }
 
-func TestSlice(t *testing.T) {
+func TestSlicestr(t *testing.T) {
        for i, this := range []struct {
                v1     interface{}
                v2     int
@@ -292,7 +292,7 @@ func TestSlice(t *testing.T) {
                {123, 1, 3, "23"},
                {tstNoStringer{}, 0, 1, false},
        } {
-               result, err := Slice(this.v1, this.v2, this.v3)
+               result, err := Slicestr(this.v1, this.v2, this.v3)
 
                if b, ok := this.expect.(bool); ok && !b {
                        if err == nil {