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:
Bob Nystrom
2014-01-02 15:32:00 +00:00
parent 003d4f77f4
commit 6fb8804c9e
25 changed files with 133 additions and 65 deletions
+2
View File
@@ -0,0 +1,2 @@
var a = [1, 2, 3]
a.insert("value", 1.5) // expect runtime error: Index must be an integer.