/[pcre]/code/trunk/RunGrepTest
ViewVC logotype

Diff of /code/trunk/RunGrepTest

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 138 by ph10, Thu Mar 29 15:20:15 2007 UTC revision 239 by ph10, Tue Sep 11 13:46:30 2007 UTC
# Line 33  done Line 33  done
33    
34  if [ -z "$srcdir" -o ! -d "$srcdir/testdata" ] ; then  if [ -z "$srcdir" -o ! -d "$srcdir/testdata" ] ; then
35    srcdir=.    srcdir=.
36  fi  fi
37    
38  # Check for the availability of UTF-8 support  # Check for the availability of UTF-8 support
39    
# Line 202  elephant" ./testdata/grepinput) >>testtr Line 202  elephant" ./testdata/grepinput) >>testtr
202  echo "---------------------------- Test 49 ------------------------------" >>testtry  echo "---------------------------- Test 49 ------------------------------" >>testtry
203  (cd $srcdir; $valgrind $pcregrep "^(abc|def|ghi|jkl)" ./testdata/grepinputx) >>testtry  (cd $srcdir; $valgrind $pcregrep "^(abc|def|ghi|jkl)" ./testdata/grepinputx) >>testtry
204    
205    echo "---------------------------- Test 50 ------------------------------" >>testtry
206    (cd $srcdir; $valgrind $pcregrep -Mv "brown\sfox" ./testdata/grepinputv) >>testtry
207    
208    echo "---------------------------- Test 51 ------------------------------" >>testtry
209    (cd $srcdir; $valgrind $pcregrep --colour=always jumps ./testdata/grepinputv) >>testtry
210    
211  # Now compare the results.  # Now compare the results.
212    
213  $cf testtry $srcdir/testdata/grepoutput  $cf $srcdir/testdata/grepoutput testtry
214  if [ $? != 0 ] ; then exit 1; fi  if [ $? != 0 ] ; then exit 1; fi
215    
216    
# Line 219  if [ $utf8 -ne 0 ] ; then Line 225  if [ $utf8 -ne 0 ] ; then
225    echo "---------------------------- Test U2 ------------------------------" >>testtry    echo "---------------------------- Test U2 ------------------------------" >>testtry
226    (cd $srcdir; $valgrind $pcregrep -n -u -C 3 --newline=any "Match" ./testdata/grepinput8) >>testtry    (cd $srcdir; $valgrind $pcregrep -n -u -C 3 --newline=any "Match" ./testdata/grepinput8) >>testtry
227    
228    $cf testtry $srcdir/testdata/grepoutput8    $cf $srcdir/testdata/grepoutput8 testtry
229    if [ $? != 0 ] ; then exit 1; fi    if [ $? != 0 ] ; then exit 1; fi
230    
231  else  else
# Line 227  else Line 233  else
233  fi  fi
234    
235    
236  # The tests for various newline values may not work in environments where  # We go to some contortions to try to ensure that the tests for the various
237  # the newlines in the files are not \n.  # newline settings will work in environments where the normal newline sequence
238    # is not \n. Do not use exported files, whose line endings might be changed.
239    # Instead, create an input file using printf so that its contents are exactly
240    # what we want. Note the messy fudge to get printf to write a string that
241    # starts with a hyphen.
242    
243  echo "Testing pcregrep newline settings"  echo "Testing pcregrep newline settings"
244    printf "abc\rdef\r\nghi\njkl" >testNinput
245    
246  echo "---------------------------- Test N1 ------------------------------" >testtry  printf "%c--------------------------- Test N1 ------------------------------\r\n" - >testtry
247  (cd $srcdir; $valgrind $pcregrep -N CR "^(abc|def|ghi|jkl)" ./testdata/grepinputx) >>testtry  $valgrind $pcregrep -n -N CR "^(abc|def|ghi|jkl)" testNinput >>testtry
248    
249  echo "---------------------------- Test N2 ------------------------------" >>testtry  printf "%c--------------------------- Test N2 ------------------------------\r\n" - >>testtry
250  (cd $srcdir; $valgrind $pcregrep --newline=crlf "^(abc|def|ghi|jkl)" ./testdata/grepinputx) >>testtry  $valgrind $pcregrep -n --newline=crlf "^(abc|def|ghi|jkl)" testNinput >>testtry
251    
252  echo "---------------------------- Test N3 ------------------------------" >>testtry  printf "%c--------------------------- Test N3 ------------------------------\r\n" - >>testtry
253  pattern=`printf 'def\rjkl'`  pattern=`printf 'def\rjkl'`
254  (cd $srcdir; $valgrind $pcregrep --newline=cr -F "$pattern" ./testdata/grepinputx) >>testtry  $valgrind $pcregrep -n --newline=cr -F "$pattern" testNinput >>testtry
255    
256  echo "---------------------------- Test n$ ------------------------------" >>testtry  printf "%c--------------------------- Test N4 ------------------------------\r\n" - >>testtry
257  pattern=`printf 'xxx\r\njkl'`  pattern=`printf 'xxx\r\njkl'`
258  (cd $srcdir; $valgrind $pcregrep --newline=crlf -F "$pattern" ./testdata/grepinputx) >>testtry  $valgrind $pcregrep -n --newline=crlf -F "$pattern" testNinput >>testtry
259    
260    printf "%c--------------------------- Test N5 ------------------------------\r\n" - >>testtry
261    $valgrind $pcregrep -n --newline=any "^(abc|def|ghi|jkl)" testNinput >>testtry
262    
263  echo "---------------------------- Test N5 ------------------------------" >>testtry  printf "%c--------------------------- Test N6 ------------------------------\r\n" - >>testtry
264  (cd $srcdir; $valgrind $pcregrep -n --newline=any "^(abc|def|ghi|jkl)" ./testdata/grepinputx) >>testtry  $valgrind $pcregrep -n --newline=anycrlf "^(abc|def|ghi|jkl)" testNinput >>testtry
265    
266  $cf testtry $srcdir/testdata/grepoutputN  $cf $srcdir/testdata/grepoutputN testtry
267  if [ $? != 0 ] ; then exit 1; fi  if [ $? != 0 ] ; then exit 1; fi
268    
269  exit 0  exit 0

Legend:
Removed from v.138  
changed lines
  Added in v.239

  ViewVC Help
Powered by ViewVC 1.1.5