shithub: mc

ref: 09a34baac6757c7a4c33e3e3c50054acbb1b70bb
dir: /lib/std/test/striter.myr/

View raw version
use std

const main = {
	var chars = ['a', 'b', 'c']
	var splits = ["foo", "+bar"]
	var i

	i = 0
	for c in std.bychar("abc")
		std.assert(chars[i++] == c, "wrong char")
	;;
	std.assert(i == chars.len, "wrong split count")

	i = 0
	for sp in std.bysplit("foo+++bar", "++")
		std.assert(std.streq(splits[i++], sp), "wrong split {}", sp)
	;;
	std.assert(i == splits.len, "wrong split count")
}