diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index a99e425..ec57fa8 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -18,6 +18,8 @@ jobs: - '1.18' - '1.19' - '1.20' + - '1.21' + - '1.22' steps: - uses: actions/checkout@v4 with: diff --git a/pkg/interpreter/interpreter.go b/pkg/interpreter/interpreter.go index fdaa9ee..f1a8f8b 100644 --- a/pkg/interpreter/interpreter.go +++ b/pkg/interpreter/interpreter.go @@ -149,6 +149,7 @@ func (intr *treeInterpreter) execute(node parsing.ASTNode, value interface{}, fu } } } + // TODO: don't we want to return an error here ? return nil, nil case parsing.ASTExpRef: return func(data interface{}) (interface{}, error) { diff --git a/pkg/interpreter/interpreter_test.go b/pkg/interpreter/interpreter_test.go index 67c6422..57e9313 100644 --- a/pkg/interpreter/interpreter_test.go +++ b/pkg/interpreter/interpreter_test.go @@ -185,6 +185,31 @@ func TestCanSupportProjectionsWithStructs(t *testing.T) { assert.Equal([]interface{}{"first", "second", "third"}, result) } +func TestCompareStrings(t *testing.T) { + assert := assert.New(t) + data := []string{"a", "b", "c"} + { + result, err := search(t, "@[?@ > 'a']", data) + assert.Nil(err) + assert.Equal([]interface{}{"b", "c"}, result) + } + { + result, err := search(t, "@[?@ >= 'b']", data) + assert.Nil(err) + assert.Equal([]interface{}{"b", "c"}, result) + } + { + result, err := search(t, "@[?@ < 'b']", data) + assert.Nil(err) + assert.Equal([]interface{}{"a"}, result) + } + { + result, err := search(t, "@[?@ <= 'b']", data) + assert.Nil(err) + assert.Equal([]interface{}{"a", "b"}, result) + } +} + func TestCanSupportSliceOfStructsWithFunctions(t *testing.T) { assert := assert.New(t) data := []scalars{{"a1", "b1"}, {"a2", "b2"}}