str-graphemes: rework and add some zig tests

- rework strGraphemes() to use a mutable slice and keep track of just
`last_codepoint_len`.
- add zig tests for empty string, ascii, utf8, ascii+utf8+emoji
This commit is contained in:
Travis Staloch 2022-10-19 09:16:12 -07:00
parent df7e4eea7e
commit c2dbed2ff5
No known key found for this signature in database
GPG key ID: 9726F5C64475E635
4 changed files with 65 additions and 80 deletions

View file

@ -145,7 +145,7 @@ comptime {
exportStrFn(str.strTrimRight, "trim_right");
exportStrFn(str.strCloneTo, "clone_to");
exportStrFn(str.withCapacity, "with_capacity");
exportStrFn(str.strGraphemes, "str_graphemes");
exportStrFn(str.strGraphemes, "graphemes");
inline for (INTEGERS) |T| {
str.exportFromInt(T, ROC_BUILTINS ++ "." ++ STR ++ ".from_int.");