Skip to content

Commit 867d64a

Browse files
committed
Merge branch 'main' into cmp-strings
Signed-off-by: Charles-Edouard Brétéché <[email protected]>
2 parents 52975c1 + 69215c4 commit 867d64a

File tree

3 files changed

+28
-0
lines changed

3 files changed

+28
-0
lines changed

.github/workflows/ci.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ jobs:
1818
- '1.18'
1919
- '1.19'
2020
- '1.20'
21+
- '1.21'
22+
- '1.22'
2123
steps:
2224
- uses: actions/checkout@v4
2325
with:

pkg/interpreter/interpreter.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ func (intr *treeInterpreter) execute(node parsing.ASTNode, value interface{}, fu
149149
}
150150
}
151151
}
152+
// TODO: don't we want to return an error here ?
152153
return nil, nil
153154
case parsing.ASTExpRef:
154155
return func(data interface{}) (interface{}, error) {

pkg/interpreter/interpreter_test.go

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,31 @@ func TestCanSupportProjectionsWithStructs(t *testing.T) {
185185
assert.Equal([]interface{}{"first", "second", "third"}, result)
186186
}
187187

188+
func TestCompareStrings(t *testing.T) {
189+
assert := assert.New(t)
190+
data := []string{"a", "b", "c"}
191+
{
192+
result, err := search(t, "@[?@ > 'a']", data)
193+
assert.Nil(err)
194+
assert.Equal([]interface{}{"b", "c"}, result)
195+
}
196+
{
197+
result, err := search(t, "@[?@ >= 'b']", data)
198+
assert.Nil(err)
199+
assert.Equal([]interface{}{"b", "c"}, result)
200+
}
201+
{
202+
result, err := search(t, "@[?@ < 'b']", data)
203+
assert.Nil(err)
204+
assert.Equal([]interface{}{"a"}, result)
205+
}
206+
{
207+
result, err := search(t, "@[?@ <= 'b']", data)
208+
assert.Nil(err)
209+
assert.Equal([]interface{}{"a", "b"}, result)
210+
}
211+
}
212+
188213
func TestCanSupportSliceOfStructsWithFunctions(t *testing.T) {
189214
assert := assert.New(t)
190215
data := []scalars{{"a1", "b1"}, {"a2", "b2"}}

0 commit comments

Comments
 (0)