ref: 9bf446ab7795f7397bc4fb7ae9e46ce14c3f679c
dir: /lib/std/test/striter.myr/
use std const main = { var chars = ['a', 'b', 'c'] var splits = ["foo", "+bar"] var graphemes = [ [0x300][:], /* disconnected accent */ [0x61][:], /* 'a' */ [0x53f2][:], /* '史', single codepoint */ [0x63][:], /* 'b' */ [0x9][:], /* '\t' */ [0x42f][:], /* 'Я' */ [0x78, 0x300, 0x300, 0x300, 0x300, 0x300][:], /* x, 4 accents */ [0xa][:], /* '\n' */ [0x7a, 0x309][:] /* 'z', accent */ ] var i i = 0 for c : std.bychar("abc") std.assert(chars[i++] == c, "wrong char") ;; std.assert(i == chars.len, "wrong split count") i = 0 for sp : std.bysplit("foo+++bar", "++") std.assert(std.eq(splits[i++], sp), "wrong split {}", sp) ;; std.assert(i == splits.len, "wrong split count") i = 0 for g : std.bygrapheme("̀a史c\tЯx̀̀̀̀̀\nz̉") std.assert(std.eq(g, graphemes[i++]), "mismatched grapheme cluster\n") ;; std.assert(i == graphemes.len, "wrong grapheme set length") }