| 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 |
|
|
| 204 |
|
|
| 205 |
# Now compare the results. |
# Now compare the results. |
| 206 |
|
|
| 207 |
$cf testtry $srcdir/testdata/grepoutput |
$cf $srcdir/testdata/grepoutput testtry |
| 208 |
if [ $? != 0 ] ; then exit 1; fi |
if [ $? != 0 ] ; then exit 1; fi |
| 209 |
|
|
| 210 |
|
|
| 219 |
echo "---------------------------- Test U2 ------------------------------" >>testtry |
echo "---------------------------- Test U2 ------------------------------" >>testtry |
| 220 |
(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 |
| 221 |
|
|
| 222 |
$cf testtry $srcdir/testdata/grepoutput8 |
$cf $srcdir/testdata/grepoutput8 testtry |
| 223 |
if [ $? != 0 ] ; then exit 1; fi |
if [ $? != 0 ] ; then exit 1; fi |
| 224 |
|
|
| 225 |
else |
else |
| 227 |
fi |
fi |
| 228 |
|
|
| 229 |
|
|
| 230 |
# 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 |
| 231 |
# the newlines in the files are not \n. |
# newline settings will work in environments where the normal newline sequence |
| 232 |
|
# is not \n. Note the messy fudge to get printf to write a string that starts |
| 233 |
|
# with a hyphen. |
| 234 |
|
|
| 235 |
echo "Testing pcregrep newline settings" |
echo "Testing pcregrep newline settings" |
| 236 |
|
|
| 237 |
echo "---------------------------- Test N1 ------------------------------" >testtry |
printf "abc\rdef\r\nghi\njkl" >$srcdir/testNinput |
| 238 |
(cd $srcdir; $valgrind $pcregrep -N CR "^(abc|def|ghi|jkl)" ./testdata/grepinputx) >>testtry |
|
| 239 |
|
printf "%c--------------------------- Test N1 ------------------------------\r\n" - >testtry |
| 240 |
|
(cd $srcdir; $valgrind $pcregrep -n -N CR "^(abc|def|ghi|jkl)" testNinput) >>testtry |
| 241 |
|
|
| 242 |
echo "---------------------------- Test N2 ------------------------------" >>testtry |
printf "%c--------------------------- Test N2 ------------------------------\r\n" - >>testtry |
| 243 |
(cd $srcdir; $valgrind $pcregrep --newline=crlf "^(abc|def|ghi|jkl)" ./testdata/grepinputx) >>testtry |
(cd $srcdir; $valgrind $pcregrep -n --newline=crlf "^(abc|def|ghi|jkl)" testNinput) >>testtry |
| 244 |
|
|
| 245 |
echo "---------------------------- Test N3 ------------------------------" >>testtry |
printf "%c--------------------------- Test N3 ------------------------------\r\n" - >>testtry |
| 246 |
pattern=`printf 'def\rjkl'` |
pattern=`printf 'def\rjkl'` |
| 247 |
(cd $srcdir; $valgrind $pcregrep --newline=cr -F "$pattern" ./testdata/grepinputx) >>testtry |
(cd $srcdir; $valgrind $pcregrep -n --newline=cr -F "$pattern" testNinput) >>testtry |
| 248 |
|
|
| 249 |
echo "---------------------------- Test n$ ------------------------------" >>testtry |
printf "%c--------------------------- Test N4 ------------------------------\r\n" - >>testtry |
| 250 |
pattern=`printf 'xxx\r\njkl'` |
pattern=`printf 'xxx\r\njkl'` |
| 251 |
(cd $srcdir; $valgrind $pcregrep --newline=crlf -F "$pattern" ./testdata/grepinputx) >>testtry |
(cd $srcdir; $valgrind $pcregrep -n --newline=crlf -F "$pattern" testNinput) >>testtry |
| 252 |
|
|
| 253 |
|
printf "%c--------------------------- Test N5 ------------------------------\r\n" - >>testtry |
| 254 |
|
(cd $srcdir; $valgrind $pcregrep -n --newline=any "^(abc|def|ghi|jkl)" testNinput) >>testtry |
| 255 |
|
|
| 256 |
echo "---------------------------- Test N5 ------------------------------" >>testtry |
printf "%c--------------------------- Test N6 ------------------------------\r\n" - >>testtry |
| 257 |
(cd $srcdir; $valgrind $pcregrep -n --newline=any "^(abc|def|ghi|jkl)" ./testdata/grepinputx) >>testtry |
(cd $srcdir; $valgrind $pcregrep -n --newline=anycrlf "^(abc|def|ghi|jkl)" testNinput) >>testtry |
| 258 |
|
|
| 259 |
$cf testtry $srcdir/testdata/grepoutputN |
$cf $srcdir/testdata/grepoutputN testtry |
| 260 |
if [ $? != 0 ] ; then exit 1; fi |
if [ $? != 0 ] ; then exit 1; fi |
| 261 |
|
|
| 262 |
exit 0 |
exit 0 |