shithub: mc

ref: 4aa0e6c6b8a1a23b144b0382d6156aaa55b2c7fd
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 : 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")
}