shithub: mc

ref: 658dd280c40c5a6edb110e1170013e8479fe2bd0
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.sleq(r, expected), \
		"expected chomp({}, {}) => {}, got {}\n", sl, pfx, expected, r)
}