From 81518f643d4d53b035b2cefbce25f06bd3cb5079 Mon Sep 17 00:00:00 2001 From: Elliott Hughes Date: Sat, 17 Aug 2019 19:53:56 -0700 Subject: echo/printf: expand test cases, fix \x corner cases. The behavior with "\xAV" (where the second hex digit is invalid) is different from the behavior with "\xVA", and echo and printf differ from each other. --- tests/echo.test | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'tests/echo.test') diff --git a/tests/echo.test b/tests/echo.test index 248454e7..80774e66 100755 --- a/tests/echo.test +++ b/tests/echo.test @@ -27,11 +27,18 @@ testcmd "-nex hello" "-nex hello" "-nex hello\n" "" "" testcmd "-e octal values" \ "-ne '\01234 \0060 \060 \0130\0131\0132 \077\012'" \ "S4 0 0 XYZ ?\n" "" "" +testcmd "-e invalid oct" "-ne 'one\\079two'" "one\a9two" "" "" +testcmd "-e \\0040" "-ne '\0040'" " " "" "" # Hexadecimal value tests testcmd "-e hexadecimal values" \ "-ne '\x534 \x30 \x58\x59\x5a \x3F\x0A'"\ "S4 0 XYZ ?\n" "" "" +testcmd "-e invalid hex 1" "-e 'one\xvdtwo'" "one\\xvdtwo\n" "" "" +testcmd "-e invalid hex 2" "-e 'one\xavtwo'" "one\nvtwo\n" "" "" + +# GNU extension for ESC +testcmd "-e \e" "-ne '\\e' | xxd -p" "1b\n" "" "" testcmd "-e \p" "-e '\\p'" "\\p\n" "" "" -- cgit v1.2.3