summaryrefslogtreecommitdiff
path: root/lib/std/test/striter.myr
blob: b54e580446b274d252784849182bb0977827f780 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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")
}