feat: replace validateIndexOld with validateIndex and add validateString for core methods
Remove the deprecated validateIndexOld function and migrate all callers to the new validateIndex that reports runtime errors. Add validateString helper for string argument checking. Introduce comprehensive runtime error tests for list and string subscript operations, removeAt, and contains methods, replacing old silent null returns with proper error halting.
This commit is contained in:
@@ -9,16 +9,3 @@ IO.write("abcd"[-4]) // expect: a
|
||||
IO.write("abcd"[-3]) // expect: b
|
||||
IO.write("abcd"[-2]) // expect: c
|
||||
IO.write("abcd"[-1]) // expect: d
|
||||
|
||||
// Handle out of bounds.
|
||||
// TODO: Should halt the fiber or raise an error somehow.
|
||||
IO.write("abcd"[4]) // expect: null
|
||||
IO.write("abcd"[-5]) // expect: null
|
||||
|
||||
// Handle wrong argument type.
|
||||
// TODO: Should halt the fiber or raise an error somehow.
|
||||
IO.write("abcd"[true]) // expect: null
|
||||
|
||||
// Handle non-integer index.
|
||||
// TODO: Should halt the fiber or raise an error somehow.
|
||||
IO.write("abcd"[1.5]) // expect: null
|
||||
|
||||
Reference in New Issue
Block a user