Closed jaroslawherod closed 7 months ago
Following code
func TestScript_Match_CaseInsensitive_Regex(t *testing.T) { data := map[string]any{ "text": "my Expected text", } expr := jp.MustNewScript(" @.text ~= /(?i)expected/ ") assert.True(t, expr.Match(data)) }
Fails with :
--- FAIL: TestScript_Match_CaseInsensitive_Regex (0.00s) panic: expected a value at 27 in @.text ~= /(?i)expected/ [recovered] panic: expected a value at 27 in @.text ~= /(?i)expected/ goroutine 7 [running]: testing.tRunner.func1.2({0x5f22c0, 0xc00002e480}) /usr/lib/go-1.21/src/testing/testing.go:1545 +0x238 testing.tRunner.func1() /usr/lib/go-1.21/src/testing/testing.go:1548 +0x397 panic({0x5f22c0?, 0xc00002e480?}) /usr/lib/go-1.21/src/runtime/panic.go:914 +0x21f github.com/ohler55/ojg/jp.(*parser).raise(0xc000059ef0, {0x62e520?, 0x28?}, {0x0?, 0x0?, 0x7f4282f91e78?}) /home/jaro/go/pkg/mod/github.com/ohler55/ojg@v1.21.0/jp/parse.go:778 +0xd4 github.com/ohler55/ojg/jp.(*parser).readEqValue(0xc000046ef0?) /home/jaro/go/pkg/mod/github.com/ohler55/ojg@v1.21.0/jp/parse.go:662 +0x4d3 github.com/ohler55/ojg/jp.(*parser).readEquation(0xc00012bef0) /home/jaro/go/pkg/mod/github.com/ohler55/ojg@v1.21.0/jp/parse.go:603 +0x326 github.com/ohler55/ojg/jp.MustNewScript({0x6316e5?, 0xc000100f60?}) /home/jaro/go/pkg/mod/github.com/ohler55/ojg@v1.21.0/jp/script.go:111 +0x7d ...
Such version is passing
func TestScript_Match_CaseInsensitive_Regex(t *testing.T) { data := map[string]any{ "text": "my Expected text", } expr := jp.MustNewScript(" (@.text ~= /(?i)expected/) ") assert.True(t, expr.Match(data)) }
I'll get it fixed.
Please try the develop branch. It has the fix. It has the fix. Released v1.21.1 with the fix.
Issue resolved :) Thanks :+1:
Following code
Fails with :
Such version is passing