diff --git a/internal/testing.go b/internal/testing.go index 9d0b1f1..54ccfaf 100644 --- a/internal/testing.go +++ b/internal/testing.go @@ -53,6 +53,15 @@ func GetScenariosFromOfficialTestSuite() Tests { return tests } + // add missing but relevant scenarios + var rule []interface{} + + scenarios = append(scenarios, + append(rule, + make(map[string]interface {}, 0), + make(map[string]interface {}, 0), + make(map[string]interface {}, 0))) + for _, scenario := range scenarios { if reflect.ValueOf(scenario).Kind() == reflect.String { continue diff --git a/jsonlogic.go b/jsonlogic.go index 8a07230..86d6382 100644 --- a/jsonlogic.go +++ b/jsonlogic.go @@ -708,7 +708,8 @@ func apply(rules, data interface{}) interface{} { return operation(operator, parseValues(values, data), data) } - return false + // an empty-map rule should return an empty-map + return make(map[string]interface{}) } // Apply read the rule and it's data from io.Reader, executes it