summaryrefslogtreecommitdiff
path: root/lib/std/test/chomp.myr
blob: 6bc9aa5e6c8e1b12909ad1d230b7e1bc74ee1068 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use std

const main = {
	check("aaab", "aaa", "b")
	check("aaa", "aaa", "")
	check("aa", "aaa", "aa")
}

const check = {sl, pfx, expected
	var r

	r = sl
	std.chomp(&r, pfx)
	std.assert(std.sleq(r, expected), \
		"expected chomp({}, {}) => {}, got {}\n", sl, pfx, expected, r)
}