From bdf85c8f90dff37b16677e58a7a676830ab9d2db Mon Sep 17 00:00:00 2001 From: kikito Date: Sun, 10 Apr 2016 13:51:20 +0200 Subject: [PATCH] Splits specs into two, to illustrate the different handling of escaped control chars --- spec/inspect_spec.lua | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/spec/inspect_spec.lua b/spec/inspect_spec.lua index d868a2a..1e4a9e0 100644 --- a/spec/inspect_spec.lua +++ b/spec/inspect_spec.lua @@ -38,9 +38,14 @@ describe( 'inspect', function() assert.equals('"I have \\b a back space"', inspect('I have \b a back space')) end) - it('escapes zeroes and other control characters properly', function() - assert.equals('"I have \\0 zeroes \\0000 and other \\1 control \\0010 characters \\6 \\17 \\0279 \\31"', - inspect('I have \0 zeroes \0000 and other \1 control \0010 characters \6 \17 \0279 \31')) + it('escapes unnamed control characters with 1 or 2 digits', function() + assert.equals('"Here are some control characters: \\0 \\1 \\6 \\17 \\27 \\31"', + inspect('Here are some control characters: \0 \1 \6 \17 \27 \31')) + end) + + it('escapes unnamed control characters with 3 digits when they are followed by numbers', function() + assert.equals('"Control chars followed by digits \\0001 \\0011 \\0061 \\0171 \\0271 \\0311"', + inspect('Control chars followed by digits \0001 \0011 \0061 \0171 \0271 \0311')) end) it('backslashes its backslashes', function()