diff options
author | Philipp Janda <siffiejoe@gmx.net> | 2015-06-02 15:14:31 +0200 |
---|---|---|
committer | Philipp Janda <siffiejoe@gmx.net> | 2015-06-02 15:14:31 +0200 |
commit | 823345b8b4de9e2a646dbcd471e05a1c7598d378 (patch) | |
tree | ab4f94969bedef33b6ed90747a6c5110486d4832 /tests | |
parent | ba065189ae67822ac9c69cc6ba633e3e8e123ef6 (diff) | |
download | lua-compat-5.3-823345b8b4de9e2a646dbcd471e05a1c7598d378.tar.gz lua-compat-5.3-823345b8b4de9e2a646dbcd471e05a1c7598d378.tar.bz2 lua-compat-5.3-823345b8b4de9e2a646dbcd471e05a1c7598d378.zip |
Compress decimal escapes for string.format("%q").
Lua 5.2+ escape all control characters using decimal escape
sequences. The previous code did the same but always used three
decimals (possibly zero-padded) no matter the following character.
The new version only uses all three decimals when another decimal
character is following.
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/test.lua | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/tests/test.lua b/tests/test.lua index f8fa894..9ac27d4 100755 --- a/tests/test.lua +++ b/tests/test.lua | |||
@@ -505,7 +505,7 @@ do | |||
505 | return _tostring(v) | 505 | return _tostring(v) |
506 | end | 506 | end |
507 | end | 507 | end |
508 | print("string.format()", string.format("%q", "\"\\\0000\0010\r0\n0\t0\"")) | 508 | print("string.format()", string.format("%q", "\"\\\0000\0010\002\r\n0\t0\"")) |
509 | print("string.format()", string.format("%12.3fx%%sxx%.6s", 3.1, {})) | 509 | print("string.format()", string.format("%12.3fx%%sxx%.6s", 3.1, {})) |
510 | print("string.format()", string.format("%-3f %%%s %%s", 3.1, true)) | 510 | print("string.format()", string.format("%-3f %%%s %%s", 3.1, true)) |
511 | print("string.format()", string.format("% 3.2g %%d %%%s", 3.1, nil)) | 511 | print("string.format()", string.format("% 3.2g %%d %%%s", 3.1, nil)) |