feat: add validateNum/validateInt helpers and runtime type checks for list methods
Replace the old validateIndex function with validateNum and validateInt helpers that produce descriptive runtime error messages. Add new test files covering invalid index types, out-of-bounds indices, and iterator validation for list insert, iterate, and iteratorValue methods. Rename existing number operator error tests to use consistent "must be a number" phrasing.
This commit is contained in:
@@ -0,0 +1 @@
|
||||
1 / false // expect runtime error: Right operand must be a number.
|
||||
@@ -1 +0,0 @@
|
||||
1 / false // expect runtime error: TypeError: Right operand must be Num.
|
||||
@@ -0,0 +1 @@
|
||||
1 - false // expect runtime error: Right operand must be a number.
|
||||
@@ -1 +0,0 @@
|
||||
1 - false // expect runtime error: TypeError: Right operand must be Num.
|
||||
@@ -0,0 +1 @@
|
||||
1 % false // expect runtime error: Right operand must be a number.
|
||||
@@ -1 +0,0 @@
|
||||
1 % false // expect runtime error: TypeError: Right operand must be Num.
|
||||
@@ -0,0 +1 @@
|
||||
1 * false // expect runtime error: Right operand must be a number.
|
||||
@@ -1 +0,0 @@
|
||||
1 * false // expect runtime error: TypeError: Right operand must be Num.
|
||||
@@ -0,0 +1,3 @@
|
||||
1 + false // expect runtime error: Right operand must be a number.
|
||||
|
||||
// TODO: What about a string on the RHS?
|
||||
@@ -1,3 +0,0 @@
|
||||
1 + false // expect runtime error: TypeError: Right operand must be Num.
|
||||
|
||||
// TODO: What about a string on the RHS?
|
||||
Reference in New Issue
Block a user