]> Savannah Git Hosting - gnulib.git/commitdiff
quotearg: fix stale tests
authorPádraig Brady <P@draigBrady.com>
Sun, 16 Oct 2016 21:51:30 +0000 (22:51 +0100)
committerPádraig Brady <P@draigBrady.com>
Sun, 16 Oct 2016 22:58:39 +0000 (23:58 +0100)
* 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
tests/test-quotearg.c
tests/test-sh-quote.c
tests/test-system-quote-main.c

index 059ff2c82ce35c6015a342667e8265b95f642c54..df2f429c058d763a6190bf68ce8bc09ad6c63514 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2016-10-16  Pádraig Brady  <P@draigBrady.com>
+
+       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  <meyering@fb.com>
 
        non-recursive-gnulib-prefix-hack: fix inconsequential typo
index e43573da37efb05f7effa329473ccbf8ac00ba8a..d9a636b994c16fcf100b6d7e8471947986cf0a59 100644 (file)
@@ -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 */
index a2633ba7dfb74a84e9aa4fa6d4500a4eceef9b40..091da34566bd85ac3fcc795e2a3cfb923b9b3221 100644 (file)
@@ -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 ("(", "'('");
index 8eb6a17cc9a1ce20d9fd69737404ea27a3ad3be0..40d7ec64876e9bfc8bcd5dfcffb2bb409cbed539 100644 (file)
@@ -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.  */