fix: validate number comparison operand types in num_lt, num_gt, num_lte, num_gte

Replace silent RETURN_NULL for non-numeric right operands with explicit runtime error via validateNum in four comparison primitives (num_lt, num_gt, num_lte, num_gte). Also remove redundant IS_NUM check in num_mod. Add four new test files verifying runtime error messages for each comparison operator when given a boolean operand.
This commit is contained in:
Bob Nystrom
2014-01-21 15:44:11 +00:00
parent f9371faf00
commit 7e3b9a6bcb
5 changed files with 8 additions and 9 deletions
@@ -0,0 +1 @@
1 >= false // expect runtime error: Right operand must be a number.
@@ -0,0 +1 @@
1 > false // expect runtime error: Right operand must be a number.
@@ -0,0 +1 @@
1 <= false // expect runtime error: Right operand must be a number.
@@ -0,0 +1 @@
1 < false // expect runtime error: Right operand must be a number.