feat: add validation to skip/take and rename split parameter for clarity

Add type and range checks to Sequence.skip() and Sequence.take() methods, aborting with "Count must be a non-negative integer." when count is not a non-negative integer. Rename split() parameter from 'delim' to 'delimiter' and update its error message from "Argument must be a non-empty string." to "Delimiter must be a non-empty string." for consistency. Remove old behavior allowing negative counts and add new test files for skip/take validation errors.
This commit is contained in:
Bob Nystrom
2017-03-15 14:22:44 +00:00
parent 38b92435bf
commit dad494093e
12 changed files with 52 additions and 28 deletions
@@ -1 +1 @@
"foo".split(1) // expect runtime error: Argument must be a non-empty string.
"foo".split(1) // expect runtime error: Delimiter must be a non-empty string.
+1 -1
View File
@@ -1 +1 @@
"foo".split("") // expect runtime error: Argument must be a non-empty string.
"foo".split("") // expect runtime error: Delimiter must be a non-empty string.