Skip to content

Commit

Permalink
Merge branch 'main' into cmp-strings
Browse files Browse the repository at this point in the history
Signed-off-by: Charles-Edouard Brétéché <[email protected]>
  • Loading branch information
eddycharly committed Jun 27, 2024
2 parents 52975c1 + 69215c4 commit 5bf4892
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ jobs:
- '1.18'
- '1.19'
- '1.20'
- '1.21'
- '1.22'
steps:
- uses: actions/checkout@v4
with:
Expand Down
25 changes: 25 additions & 0 deletions pkg/interpreter/interpreter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"}}
Expand Down

0 comments on commit 5bf4892

Please sign in to comment.