File tree 2 files changed +11
-0
lines changed
main/kotlin/eu/afse/jsonlogic
test/kotlin/eu/afse/jsonlogic 2 files changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -41,6 +41,8 @@ class JsonLogic {
41
41
evaluate(logic, data)
42
42
} catch (e: kotlin.NotImplementedError ) {
43
43
false
44
+ } catch (e: java.lang.Exception ) {
45
+ false
44
46
}
45
47
} else evaluate(logic, data)
46
48
@@ -234,6 +236,7 @@ class JsonLogic {
234
236
a is String && b is Number -> compareValues(a.doubleValue, b.toDouble())
235
237
a is Number && b is String -> compareValues(a.toDouble(), b.doubleValue)
236
238
a is String && b is String -> compareValues(a.toString().unStringify, b.toString().unStringify)
239
+ a is Boolean || b is Boolean -> compareValues(a.truthy, b.truthy)
237
240
else -> compareValues(a, b)
238
241
}
239
242
Original file line number Diff line number Diff line change @@ -323,4 +323,12 @@ class JsonLogicTests {
323
323
val result = jsonLogic.apply (logic, data)
324
324
assertEquals(" null" , result)
325
325
}
326
+
327
+ @Test
328
+ fun compareBooleanWithString () {
329
+ val jsonLogic = JsonLogic ()
330
+ val logic = mapOf (" ==" to listOf (" true" , true ))
331
+ val result = jsonLogic.apply (logic)
332
+ assertEquals(" true" , result)
333
+ }
326
334
}
You can’t perform that action at this time.
0 commit comments