aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2009-11-30 12:41:12 +0200
committerSergey Poznyakoff <gray@gnu.org.ua>2009-11-30 12:41:12 +0200
commit4c68f93c0c664e13a8572b43e33c138ce3bb8d28 (patch)
tree626d0381fec6759a51b060ca4478002d7f935aca /tests
parentd72e8be5e16ce4f4a87e43a4e764b534292aacc1 (diff)
downloadwydawca-4c68f93c0c664e13a8572b43e33c138ce3bb8d28.tar.gz
wydawca-4c68f93c0c664e13a8572b43e33c138ce3bb8d28.tar.bz2
Minor fixes.
* tests/wsbatch.c: Fix diagnostics.
Diffstat (limited to 'tests')
-rw-r--r--tests/wsbatch.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/tests/wsbatch.c b/tests/wsbatch.c
index 5d986db..372c3ba 100644
--- a/tests/wsbatch.c
+++ b/tests/wsbatch.c
@@ -39,30 +39,32 @@ runtest (const char **input, struct wordsplit *wsinit, int flags)
39 i++; 39 i++;
40 for (j = 0; input[i+j]; j++); 40 for (j = 0; input[i+j]; j++);
41 41
42 count++; 42 count++;
43 if (wordsplit (text, &ws, flags)) 43 if (wordsplit (text, &ws, flags))
44 { 44 {
45 fprintf (stderr, "E: %s: parse failed\n", input); 45 fprintf (stderr, "E: %s: parse failed\n", text);
46 errors++; 46 errors++;
47 } 47 }
48 else if (ws.ws_wordc != j) 48 else if (ws.ws_wordc != j)
49 { 49 {
50 fprintf (stderr, "E: %s: wrong number of fields (%lu/%lu)\n", 50 fprintf (stderr, "E: %s: wrong number of fields (%lu/%lu)\n",
51 text, ws.ws_wordc, j); 51 text,
52 (unsigned long) ws.ws_wordc, (unsigned long) j);
52 errors++; 53 errors++;
53 } 54 }
54 else 55 else
55 { 56 {
56 size_t k; 57 size_t k;
57 58
58 for (k = 0; k < ws.ws_wordc; k++) 59 for (k = 0; k < ws.ws_wordc; k++)
59 if (strcmp (ws.ws_wordv[k], input[i + k])) 60 if (strcmp (ws.ws_wordv[k], input[i + k]))
60 { 61 {
61 fprintf (stderr, "E: %s: word %lu mismatch: %s/%s\n", 62 fprintf (stderr, "E: %s: word %lu mismatch: %s/%s\n",
62 text, k, ws.ws_wordv[k], input[i + k]); 63 text, (unsigned long) k,
64 ws.ws_wordv[k], input[i + k]);
63 errors++; 65 errors++;
64 break; 66 break;
65 } 67 }
66 } 68 }
67 i += j; 69 i += j;
68 } 70 }
@@ -135,12 +137,12 @@ main ()
135 runtest (testcol, &ws, WRDSF_NOVAR | WRDSF_NOCMD | WRDSF_DELIM); 137 runtest (testcol, &ws, WRDSF_NOVAR | WRDSF_NOCMD | WRDSF_DELIM);
136 138
137 ws.ws_delim = " =,"; 139 ws.ws_delim = " =,";
138 runtest (testcol2, &ws, 140 runtest (testcol2, &ws,
139 WRDSF_NOVAR | WRDSF_NOCMD | WRDSF_DELIM | WRDSF_RETURN_DELIMS); 141 WRDSF_NOVAR | WRDSF_NOCMD | WRDSF_DELIM | WRDSF_RETURN_DELIMS);
140 142
141 printf ("Tests: %lu\n", count); 143 printf ("Tests: %lu\n", (unsigned long) count);
142 if (errors) 144 if (errors)
143 printf ("Failures: %lu\n", errors); 145 printf ("Failures: %lu\n", (unsigned long) errors);
144 return errors ? 1 : 0; 146 return errors ? 1 : 0;
145} 147}
146 148

Return to:

Send suggestions and report system problems to the System administrator.