aboutsummaryrefslogtreecommitdiff
path: root/libiberty/testsuite
diff options
context:
space:
mode:
authorDaniel Gutson <dgutson@codesourcery.com>2009-10-08 15:14:41 +0000
committerDaniel Gutson <dgutson@gcc.gnu.org>2009-10-08 15:14:41 +0000
commit70277b30730f0356c6cc70eccc8922f4447cbe5e (patch)
treef496006babd0cc6d4ae1f11b988d6c0fc1307d4d /libiberty/testsuite
parent38bf8621d92a1a3129fc453f275ccbf7704eba19 (diff)
downloadgcc-70277b30730f0356c6cc70eccc8922f4447cbe5e.zip
gcc-70277b30730f0356c6cc70eccc8922f4447cbe5e.tar.gz
gcc-70277b30730f0356c6cc70eccc8922f4447cbe5e.tar.bz2
argv.c (consume_whitespace): New function.
2009-10-08 Daniel Gutson <dgutson@codesourcery.com> Daniel Jacobowitz <dan@codesourcery.com> Pedro Alves <pedro@codesourcery.com> libiberty/ * argv.c (consume_whitespace): New function. (only_whitespace): New function. (buildargv): Always use ISSPACE by calling consume_whitespace. (expandargv): Skip empty files. Do not stop at the first empty argument (calling only_whitespace).. * testsuite/test-expandargv.c: (test_data): Test empty lines and empty arguments. (run_tests): Fix false positives due to shorter arguments. Co-Authored-By: Daniel Jacobowitz <dan@codesourcery.com> Co-Authored-By: Pedro Alves <pedro@codesourcery.com> From-SVN: r152560
Diffstat (limited to 'libiberty/testsuite')
-rw-r--r--libiberty/testsuite/test-expandargv.c34
1 files changed, 33 insertions, 1 deletions
diff --git a/libiberty/testsuite/test-expandargv.c b/libiberty/testsuite/test-expandargv.c
index 9d1af01..c16a032 100644
--- a/libiberty/testsuite/test-expandargv.c
+++ b/libiberty/testsuite/test-expandargv.c
@@ -107,6 +107,38 @@ const char *test_data[] = {
ARGV0,
0,
+ /* Test 4 - Check for options beginning with an empty line. */
+ "\na\nb", /* Test 4 data */
+ ARGV0,
+ "@test-expandargv-4.lst",
+ 0,
+ ARGV0,
+ "a",
+ "b",
+ 0,
+
+ /* Test 5 - Check for options containing an empty argument. */
+ "a\n''\nb", /* Test 5 data */
+ ARGV0,
+ "@test-expandargv-5.lst",
+ 0,
+ ARGV0,
+ "a",
+ "",
+ "b",
+ 0,
+
+ /* Test 6 - Check for options containing a quoted newline. */
+ "a\n'a\n\nb'\nb", /* Test 6 data */
+ ARGV0,
+ "@test-expandargv-6.lst",
+ 0,
+ ARGV0,
+ "a",
+ "a\n\nb",
+ "b",
+ 0,
+
0 /* Test done marker, don't remove. */
};
@@ -246,7 +278,7 @@ run_tests (const char **test_data)
/* Compare each of the argv's ... */
else
for (k = 0; k < argc_after; k++)
- if (strncmp (argv_before[k], argv_after[k], strlen(argv_after[k])) != 0)
+ if (strcmp (argv_before[k], argv_after[k]) != 0)
{
printf ("FAIL: test-expandargv-%d. Arguments don't match.\n", i);
failed++;