shithub: mc

ref: 8e1bb5d4fc204ce149ceb545aef7b783d73641bc
dir: /lib/escfmt/test/escre.myr/

View raw version
use std
use escfmt
use testr

const main = {
	testr.run([\
		[.name="unchanged", .fn={ctx
			var s = std.fmt("{}", escfmt.url("word"))
			testr.check(ctx, std.sleq("word", s), std.fmt("mismatched escape {}", s))
			std.slfree(s)
		}],
		[.name="randomcrud", .fn={ctx
			var s = std.fmt("{}", escfmt.re("^:/?#[]@!$&'()*+,;=%"))
			testr.check(ctx, \
				std.sleq("\\^:/\\?#\\[\\]@!\\$&'\\(\\)\\*\\+,;=%", s), \
				std.fmt("mismatched escape {}", s))
			std.slfree(s)
		}],
	][:])
}