X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=tests%2Ftest-pipe-filter-gi1.c;h=b1f94e114f4dd9c0905504ca5bd0ea3864c30389;hb=e81d3b1b46e69f9799deb665769f9796c4e454e6;hp=00cbb06f206f2265967d86f28f6e6004cf3d78b9;hpb=a3ae6e8ac4e122d3492ea9739e7cd0242fca9a31;p=gnulib.git diff --git a/tests/test-pipe-filter-gi1.c b/tests/test-pipe-filter-gi1.c index 00cbb06f2..b1f94e114 100644 --- a/tests/test-pipe-filter-gi1.c +++ b/tests/test-pipe-filter-gi1.c @@ -1,5 +1,5 @@ /* Test of filtering of data through a subprocess. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009-2011 Free Software Foundation, Inc. Written by Bruno Haible , 2009. This program is free software: you can redistribute it and/or modify @@ -19,29 +19,15 @@ #include "pipe-filter.h" -#include -#include - #include "binary-io.h" #include "c-ctype.h" #include "read-file.h" #include "progname.h" - -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" -/* Pipe a text file through 'tr a-z A-Z', which converts ASCII characters from - lower case to upper case. */ +/* Pipe a text file through 'tr "[a-z]" "[A-Z]"', which converts ASCII + characters from lower case to upper case. */ struct locals { @@ -70,12 +56,12 @@ done_read (void *data_read, size_t num_bytes_read, void *private_data) { /* Handle conversion NL -> CRLF possibly done by the child process. */ if (!(O_BINARY && *q == '\r')) - { - char orig = *p; - char expected = c_toupper (orig); - ASSERT (*q == expected); - p++; - } + { + char orig = *p; + char expected = c_toupper (orig); + ASSERT (*q == expected); + p++; + } } l->nread = p - l->input; } @@ -110,12 +96,12 @@ main (int argc, char *argv[]) l.nread = 0; argv[0] = tr_program; - argv[1] = "a-z"; - argv[2] = "A-Z"; + argv[1] = "[a-z]"; + argv[2] = "[A-Z]"; argv[3] = NULL; f = pipe_filter_gi_create ("tr", tr_program, argv, false, true, - prepare_read, done_read, &l); + prepare_read, done_read, &l); ASSERT (f != NULL); result = pipe_filter_gi_write (f, input, input_size); ASSERT (result == 0);