shithub: mc

ref: 690ab7aa8e6c56a4ae8a2bd5bce58d1df681234e
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)
}