-
Notifications
You must be signed in to change notification settings - Fork 350
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix/no panic will fix panic if a rule don't have Description. Issue #120
(#126) * added index for viewdoc * pushing first viewdoc * Added more formating for viewdoc * Added goornogo coverage test pipeline * Lowering minimum coverage by 0.1 % to pass on travis * change circle-ci to use goornogo * Added default description for rules that don't have description
- Loading branch information
Showing
4 changed files
with
38 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package builder | ||
|
||
import ( | ||
"github.com/hyperjumptech/grule-rule-engine/ast" | ||
"github.com/hyperjumptech/grule-rule-engine/pkg" | ||
"github.com/stretchr/testify/assert" | ||
"testing" | ||
) | ||
|
||
func TestNoPanic(t *testing.T) { | ||
GRL := `rule TestNoDesc { when true then Ok(); }` | ||
lib := ast.NewKnowledgeLibrary() | ||
ruleBuilder := NewRuleBuilder(lib) | ||
err := ruleBuilder.BuildRuleFromResource("CallingLog", "0.1.1", pkg.NewBytesResource([]byte(GRL))) | ||
assert.NoError(t, err) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package examples | ||
|
||
import ( | ||
"github.com/hyperjumptech/grule-rule-engine/ast" | ||
"github.com/hyperjumptech/grule-rule-engine/builder" | ||
"github.com/hyperjumptech/grule-rule-engine/pkg" | ||
"github.com/stretchr/testify/assert" | ||
"testing" | ||
) | ||
|
||
func TestNoPanicForNoDescription(t *testing.T) { | ||
GRL := `rule TestNoDesc { when true then Ok(); }` | ||
lib := ast.NewKnowledgeLibrary() | ||
ruleBuilder := builder.NewRuleBuilder(lib) | ||
err := ruleBuilder.BuildRuleFromResource("CallingLog", "0.1.1", pkg.NewBytesResource([]byte(GRL))) | ||
assert.NoError(t, err) | ||
_ = lib.NewKnowledgeBaseInstance("CallingLog", "0.1.1") | ||
} |