From 59aa69fd68eb8426b9f67a0023ed54834e84ceb4 Mon Sep 17 00:00:00 2001 From: =?utf8?q?P=C3=A1draig=20Brady?= Date: Sun, 16 Oct 2016 22:51:30 +0100 Subject: [PATCH] quotearg: fix stale tests * tests/test-quotearg.c [locale_results]: Add the missing str7 entries to the expected results. tests/test-system-quote-main.c (check_one): Don't enforce that we don't write beyond the returned length, since that's no longer the case if we switch to a more concise quoting style. * tests/test-sh-quote.c (check_one): Likewise. (main): Adjust for the new more concise quoting style. Reported by Bruno Haible. --- ChangeLog | 12 ++++++++++++ tests/test-quotearg.c | 12 ++++++------ tests/test-sh-quote.c | 4 +--- tests/test-system-quote-main.c | 2 -- 4 files changed, 19 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index 059ff2c82c..df2f429c05 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2016-10-16 Pádraig Brady + + quotearg: fix stale tests + * tests/test-quotearg.c [locale_results]: Add the missing str7 + entries to the expected results. + tests/test-system-quote-main.c (check_one): Don't enforce that we + don't write beyond the returned length, since that's no longer the + case if we switch to a more concise quoting style. + * tests/test-sh-quote.c (check_one): Likewise. + (main): Adjust for the new more concise quoting style. + Reported by Bruno Haible. + 2016-10-16 Jim Meyering non-recursive-gnulib-prefix-hack: fix inconsequential typo diff --git a/tests/test-quotearg.c b/tests/test-quotearg.c index e43573da37..d9a636b994 100644 --- a/tests/test-quotearg.c +++ b/tests/test-quotearg.c @@ -37,24 +37,24 @@ static struct result_groups locale_results[] = { /* locale_quoting_style */ { { LQ RQ, LQ "\\0001\\0" RQ, 11, LQ "simple" RQ, LQ " \\t\\n'\"\\033?""?/\\\\" RQ, LQ "a:b" RQ, LQ "a\\\\b" RQ, - LQ LQ RQ_ESC RQ, LQ LQ RQ_ESC RQ }, + LQ "a' b" RQ, LQ LQ RQ_ESC RQ, LQ LQ RQ_ESC RQ }, { LQ RQ, LQ "\\0001\\0" RQ, 11, LQ "simple" RQ, LQ " \\t\\n'\"\\033?""?/\\\\" RQ, LQ "a:b" RQ, LQ "a\\\\b" RQ, - LQ LQ RQ_ESC RQ, LQ LQ RQ_ESC RQ}, + LQ "a' b" RQ, LQ LQ RQ_ESC RQ, LQ LQ RQ_ESC RQ}, { LQ RQ, LQ "\\0001\\0" RQ, 11, LQ "simple" RQ, LQ " \\t\\n'\"\\033?""?/\\\\" RQ, LQ "a\\:b" RQ, LQ "a\\\\b" RQ, - LQ LQ RQ_ESC RQ, LQ LQ RQ_ESC RQ } }, + LQ "a' b" RQ, LQ LQ RQ_ESC RQ, LQ LQ RQ_ESC RQ } }, /* clocale_quoting_style */ { { LQ RQ, LQ "\\0001\\0" RQ, 11, LQ "simple" RQ, LQ " \\t\\n'\"\\033?""?/\\\\" RQ, LQ "a:b" RQ, LQ "a\\\\b" RQ, - LQ LQ RQ_ESC RQ, LQ LQ RQ_ESC RQ }, + LQ "a' b" RQ, LQ LQ RQ_ESC RQ, LQ LQ RQ_ESC RQ }, { LQ RQ, LQ "\\0001\\0" RQ, 11, LQ "simple" RQ, LQ " \\t\\n'\"\\033?""?/\\\\" RQ, LQ "a:b" RQ, LQ "a\\\\b" RQ, - LQ LQ RQ_ESC RQ, LQ LQ RQ_ESC RQ }, + LQ "a' b" RQ, LQ LQ RQ_ESC RQ, LQ LQ RQ_ESC RQ }, { LQ RQ, LQ "\\0001\\0" RQ, 11, LQ "simple" RQ, LQ " \\t\\n'\"\\033?""?/\\\\" RQ, LQ "a\\:b" RQ, LQ "a\\\\b" RQ, - LQ LQ RQ_ESC RQ, LQ LQ RQ_ESC RQ } } + LQ "a' b" RQ, LQ LQ RQ_ESC RQ, LQ LQ RQ_ESC RQ } } }; #endif /* ENABLE_NLS */ diff --git a/tests/test-sh-quote.c b/tests/test-sh-quote.c index a2633ba7df..091da34566 100644 --- a/tests/test-sh-quote.c +++ b/tests/test-sh-quote.c @@ -41,11 +41,9 @@ check_one (const char *input, const char *expected) ASSERT (output_len <= sizeof (buf) - 2); memset (buf, '\0', output_len + 1); - buf[output_len + 1] = '%'; bufend = shell_quote_copy (buf, input); ASSERT (bufend == buf + output_len); ASSERT (memcmp (buf, output, output_len + 1) == 0); - ASSERT (buf[output_len + 1] == '%'); ASSERT (strcmp (output, expected) == 0); @@ -91,7 +89,7 @@ main (void) check_one ("&", "'&'"); /* "'" would be interpreted as the start of a string. */ - check_one ("'foo'bar", "''\\''foo'\\''bar'"); /* or "\"'foo'bar\"" */ + check_one ("'foo'bar", "\"'foo'bar\""); /* '(' at the beginning of argv[0] would introduce a subshell command. */ check_one ("(", "'('"); diff --git a/tests/test-system-quote-main.c b/tests/test-system-quote-main.c index 8eb6a17cc9..40d7ec6487 100644 --- a/tests/test-system-quote-main.c +++ b/tests/test-system-quote-main.c @@ -58,11 +58,9 @@ check_one (enum system_command_interpreter interpreter, const char *prog, ASSERT (output_len <= sizeof (buf) - 2); memset (buf, '\0', output_len + 1); - buf[output_len + 1] = '%'; bufend = system_quote_copy (buf, interpreter, input); ASSERT (bufend == buf + output_len); ASSERT (memcmp (buf, output, output_len + 1) == 0); - ASSERT (buf[output_len + 1] == '%'); /* Store INPUT in EXPECTED_DATA_FILE, for verification by the child process. */ -- 2.39.5