shithub: mc

ref: b31626248ea64c23d2020846e2cac1c751348b61
dir: /lib/std/test/chomp.myr/

View raw version
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.eq(r, expected), \
		"expected chomp({}, {}) => {}, got {}\n", sl, pfx, expected, r)
}