fix: coerce booleans to numbers for comparison in exprparser (#1030)

Co-Authored-By: Markus Wolf <[email protected]>

Co-authored-by: Markus Wolf <[email protected]>
Co-authored-by: Casey Lee <[email protected]>
This commit is contained in:
authored and GitHub committed 2022-03-14 16:38:42 +00:00
1 parent 14c98015c5
commit aab2af0919
2 files changed
+7 -1

No files matched your search

+4
View File
@@ -121,6 +121,10 @@ func TestOperatorsCompare(t *testing.T) {
{`0 == '' }}`, true, "string-0-coercion-alt"},
{`3 == '3' }}`, true, "string-3-coercion-alt"},
{`'TEST' == 'test' }}`, true, "string-casing"},
{"true > false }}", true, "bool-greater-than"},
{"true >= false }}", true, "bool-greater-than-eq"},
{"true >= true }}", true, "bool-greater-than-1"},
{"true != false }}", true, "bool-not-equal"},
{`fromJSON('{}') < 2 }}`, false, "object-with-less"},
{`fromJSON('{}') < fromJSON('[]') }}`, false, "object/arr-with-lt"},
{`fromJSON('{}') > fromJSON('[]') }}`, false, "object/arr-with-gt"},