From 22c8032bd7267cc0de927761f9331f0e40d2f0a7 Mon Sep 17 00:00:00 2001 From: Springcomp Date: Tue, 14 Jan 2025 12:29:42 +0000 Subject: [PATCH] Added unit-test for failing case Signed-off-by: Springcomp --- pkg/interpreter/interpreter_test.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pkg/interpreter/interpreter_test.go b/pkg/interpreter/interpreter_test.go index f379e96..47e9394 100644 --- a/pkg/interpreter/interpreter_test.go +++ b/pkg/interpreter/interpreter_test.go @@ -200,6 +200,13 @@ func TestCanSupportEvaluatingRightHandSideOfStringSlice(t *testing.T) { assert.Nil(err) assert.Equal(result.(float64), 3.0) } +func TestErrEvaluatingRightHandSideOfStringSlice(t *testing.T) { + assert := assert.New(t) + data := make(map[string]interface{}) + _, err := search(t, "'foo'[:].unknown(@)", data) + assert.NotNil(err) + assert.Equal("unknown function: unknown", err.Error()) +} func BenchmarkInterpretSingleFieldStruct(b *testing.B) { assert := assert.New(b)