We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Describe the bug Grule engine panics and then recovers with an error:
panic: expression 1 is not on the clone table [recovered] panic: expression 1 is not on the clone table
To Reproduce Steps to reproduce the behavior:
type TestData struct { Strings []string } func (f *TestData) GetStrings() []string { return f.Strings } const rule = ` rule test { when Fact.GetStrings()[0] == Fact.GetStrings()[1] then Complete(); }` func TestSliceFunctionTest(t *testing.T) { fact := &TestData{ Strings: []string{"0", "0"}, } dataContext := ast.NewDataContext() err := dataContext.Add("Fact", fact) assert.NoError(t, err) knowledgeLibrary := ast.NewKnowledgeLibrary() ruleBuilder := builder.NewRuleBuilder(knowledgeLibrary) err = ruleBuilder.BuildRuleFromResource("test", "0.0.1", pkg.NewBytesResource([]byte(rule))) assert.NoError(t, err) knowledgeBase := knowledgeLibrary.NewKnowledgeBaseInstance("test", "0.0.1") engine := engine.NewGruleEngine() err = engine.Execute(dataContext, knowledgeBase) assert.NoError(t, err) }
Expected behavior No error executing the Grule engine.
Additional context Test logs:
--- FAIL: TestSliceFunctionTest (0.00s) panic: expression 1 is not on the clone table [recovered] panic: expression 1 is not on the clone table goroutine 6 [running]: testing.tRunner.func1.2({0x156e480, 0xc0001ed8d0}) /usr/local/go/src/testing/testing.go:1209 +0x24e testing.tRunner.func1() /usr/local/go/src/testing/testing.go:1212 +0x218 panic({0x156e480, 0xc0001ed8d0}) /usr/local/go/src/runtime/panic.go:1038 +0x215 github.com/hyperjumptech/grule-rule-engine/ast.(*WorkingMemory).Clone(0xc00007f2c0, 0xc000233c58) /Users/pchamorro/go/pkg/mod/github.com/hyperjumptech/grule-rule-engine@v1.10.5/ast/WorkingMemory.go:147 +0x11ff github.com/hyperjumptech/grule-rule-engine/ast.(*KnowledgeBase).Clone(0xc0001ca0a0, 0xc000233c58) /Users/pchamorro/go/pkg/mod/github.com/hyperjumptech/grule-rule-engine@v1.10.5/ast/KnowledgeBase.go:217 +0x125 github.com/hyperjumptech/grule-rule-engine/ast.(*KnowledgeLibrary).NewKnowledgeBaseInstance(0xc000233e30, {0x1638db6, 0x0}, {0x1638f28, 0x5}) /Users/pchamorro/go/pkg/mod/github.com/hyperjumptech/grule-rule-engine@v1.10.5/ast/KnowledgeBase.go:125 +0x194
The text was updated successfully, but these errors were encountered:
Fixed with #306
Sorry, something went wrong.
No branches or pull requests
Describe the bug
Grule engine panics and then recovers with an error:
To Reproduce
Steps to reproduce the behavior:
Expected behavior
No error executing the Grule engine.
Additional context
Test logs:
The text was updated successfully, but these errors were encountered: