Commit Graph

3 Commits

Author SHA1 Message Date
Bob Nystrom
8fa4f9c1bb refactor: change wrenStringFind to return UINT32_MAX instead of haystack->length for not-found
The wrenStringFind function previously returned the haystack length to indicate
a missing needle, which was ambiguous when the needle could legitimately appear
at the end of the string. This commit changes the sentinel value to UINT32_MAX,
updates all callers (string_contains, string_indexOf) to check against the new
sentinel, and adds explicit handling for empty needle and empty haystack edge
cases. The Boyer-Moore-Horspool implementation is also cleaned up with clearer
variable names and comments.
2015-02-05 04:23:50 +00:00
Bob Nystrom
735268f620 test: add non-ASCII UTF-8 test cases for contains, endsWith, equality, indexOf, and startsWith string methods 2015-01-22 23:28:54 +00:00
Bob Nystrom
6928ba9935 chore: rename test files to snake_case and update string class docs
Rename indexOf.wren and startsWith.wren test files to index_of.wren and
starts_with.wren respectively, fix missing trailing newlines, update
string class documentation to clarify UTF-8 storage and move the
note about incorrect UTF-8 handling in the index operator, and
remove unnecessary parentheses in string_indexOf native return.
2015-01-12 03:13:15 +00:00