shithub: mc

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