blob: 90b38ede98b176bc26e99eac54d268039a2302bc (
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.streq(splits[i++], sp), "wrong split {}", sp)
;;
std.assert(i == splits.len, "wrong split count")
}
|