shithub: mc

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