diff --git a/index_test.go b/index_test.go index e2ce40c..5608514 100644 --- a/index_test.go +++ b/index_test.go @@ -16,9 +16,8 @@ func TestCollections(t *testing.T) { /* 2 */ {`"abcdef"[:3]`, "abc", nil}, /* 3 */ {`"abcdef"[1:]`, "bcdef", nil}, /* 4 */ {`"abcdef"[:]`, "abcdef", nil}, - // /* 5 */ {`[0,1,2,3,4]`, []any{int64(0), int64(1), int64(2), int64(3), int64(4)}, nil}, // /* 5 */ {`[0,1,2,3,4][:]`, ListType{int64(0), int64(1), int64(2), int64(3), int64(4)}, nil}, - /* 6 */ {`"abcdef"[1:2:3]`, nil, errors.New(`[1:14] left operand '(1, 2)' [pair] and right operand '3' [integer] are not compatible with operator ":"`)}, + /* 5 */ {`"abcdef"[1:2:3]`, nil, errors.New(`[1:14] left operand '(1, 2)' [pair] and right operand '3' [integer] are not compatible with operator ":"`)}, } t.Setenv("EXPR_PATH", ".") diff --git a/list_test.go b/list_test.go index b64ac77..8905aa5 100644 --- a/list_test.go +++ b/list_test.go @@ -45,6 +45,7 @@ func TestListParser(t *testing.T) { /* 23 */ {`a=[1,2]; (a)<<3; 1`, []any{1, 2}, nil}, /* 24 */ {`["a","b","c","d"][1]`, "b", nil}, /* 25 */ {`["a","b","c","d"][1,1]`, nil, errors.New(`[1:19] one index only is allowed`)}, + /* 26 */ {`[0,1,2,3,4][:]`, ListType{int64(0), int64(1), int64(2), int64(3), int64(4)}, nil}, // /* 8 */ {`[int(x)|x=csv("test.csv",1,all(),1)]`, []any{int64(10), int64(40), int64(20)}, nil}, // /* 9 */ {`sum(@[int(x)|x=csv("test.csv",1,all(),1)])`, []any{int64(10), int64(40), int64(20)}, nil}, diff --git a/operator-index.go b/operator-index.go index 9660909..a9aa75f 100644 --- a/operator-index.go +++ b/operator-index.go @@ -61,9 +61,6 @@ func evalIndex(ctx ExprContext, self *term) (v any, err error) { var indexList *ListType var ok bool - // if err = self.checkOperands(); err != nil { - // return - // } if leftValue, rightValue, err = self.evalInfix(ctx); err != nil { return }