From a2e7b1829d1915883539e46dd841e6af7abc397a Mon Sep 17 00:00:00 2001 From: Springcomp Date: Wed, 21 Jun 2023 22:13:09 +0200 Subject: [PATCH] Added unit-test Signed-off-by: Springcomp --- pkg/interpreter/interpreter_test.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pkg/interpreter/interpreter_test.go b/pkg/interpreter/interpreter_test.go index 8e8d015..f379e96 100644 --- a/pkg/interpreter/interpreter_test.go +++ b/pkg/interpreter/interpreter_test.go @@ -193,6 +193,14 @@ func TestCanSupportSliceOfStructsWithFunctions(t *testing.T) { assert.Equal(result.(float64), 2.0) } +func TestCanSupportEvaluatingRightHandSideOfStringSlice(t *testing.T) { + assert := assert.New(t) + data := make(map[string]interface{}) + result, err := search(t, "'foo'[:].length(@)", data) + assert.Nil(err) + assert.Equal(result.(float64), 3.0) +} + func BenchmarkInterpretSingleFieldStruct(b *testing.B) { assert := assert.New(b) intr := NewInterpreter(nil, nil)