Software /
code /
prosody
Diff
spec/util_format_spec.lua @ 11638:5f4a657136bc
util.format: Escape ASCII control characters in output
This should offer some protection against doing evil things to
terminals. Doesn't protect against pure broken UTF-8 garbage however.
See #734
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Tue, 15 Jun 2021 23:24:23 +0200 |
parent | 10035:386f085820e6 |
child | 11644:fc1b8fe94d04 |
line wrap: on
line diff
--- a/spec/util_format_spec.lua Tue Jun 29 14:25:57 2021 +0100 +++ b/spec/util_format_spec.lua Tue Jun 15 23:24:23 2021 +0200 @@ -15,5 +15,10 @@ assert.equal("[1.5]", format("%d", 1.5)); assert.equal("[7.3786976294838e+19]", format("%d", 73786976294838206464)); end); + + it("escapes ascii control stuff", function () + assert.equal("␁", format("%s", "\1")); + end); + end); end);