ref: 15392a525cae61a9fc06d40cd4846664512661b2
dir: /lib/escfmt/test/eschtml.myr/
use std
use escfmt
use testr
const main = {
testr.run([\
[.name="nop", .fn={ctx
var s = std.fmt("{}", escfmt.html("word"))
testr.check(ctx, std.sleq("word", s), "mismatched escape")
std.slfree(s)
}],
[.name="twowords", .fn={ctx
var s = std.fmt("{}", escfmt.html("spaced word"))
testr.check(ctx, std.sleq("spaced word", s), "mismatched escape")
std.slfree(s)
}],
[.name="quoted", .fn={ctx
var s = std.fmt("{}", escfmt.html("<stuff> </stuff>"))
testr.check(ctx, std.sleq("<stuff>&nbsp;</stuff>", s), std.fmt("mismatched escape {}", s))
std.slfree(s)
}],
[.name="doublequoted", .fn={ctx
var s = std.fmt("{}", escfmt.html("<stuff>&nbsp;</stuff>"))
testr.check(ctx, std.sleq("&lt;stuff&gt;&amp;nbsp;&lt;&#x2f;stuff&gt;", s), std.fmt("mismatched escape {}", s))
std.slfree(s)
}],
][:])
}