229 |
|
|
230 |
# We go to some contortions to try to ensure that the tests for the various |
# We go to some contortions to try to ensure that the tests for the various |
231 |
# newline settings will work in environments where the normal newline sequence |
# 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 |
# is not \n. Do not use exported files, whose line endings might be changed. |
233 |
# with a hyphen. |
# Instead, create an input file using printf so that its contents are exactly |
234 |
|
# what we want. Note the messy fudge to get printf to write a string that |
235 |
|
# starts with a hyphen. |
236 |
|
|
237 |
echo "Testing pcregrep newline settings" |
echo "Testing pcregrep newline settings" |
238 |
|
printf "abc\rdef\r\nghi\njkl" >testNinput |
|
printf "abc\rdef\r\nghi\njkl" >$srcdir/testNinput |
|
239 |
|
|
240 |
printf "%c--------------------------- Test N1 ------------------------------\r\n" - >testtry |
printf "%c--------------------------- Test N1 ------------------------------\r\n" - >testtry |
241 |
(cd $srcdir; $valgrind $pcregrep -n -N CR "^(abc|def|ghi|jkl)" testNinput) >>testtry |
$valgrind $pcregrep -n -N CR "^(abc|def|ghi|jkl)" testNinput >>testtry |
242 |
|
|
243 |
printf "%c--------------------------- Test N2 ------------------------------\r\n" - >>testtry |
printf "%c--------------------------- Test N2 ------------------------------\r\n" - >>testtry |
244 |
(cd $srcdir; $valgrind $pcregrep -n --newline=crlf "^(abc|def|ghi|jkl)" testNinput) >>testtry |
$valgrind $pcregrep -n --newline=crlf "^(abc|def|ghi|jkl)" testNinput >>testtry |
245 |
|
|
246 |
printf "%c--------------------------- Test N3 ------------------------------\r\n" - >>testtry |
printf "%c--------------------------- Test N3 ------------------------------\r\n" - >>testtry |
247 |
pattern=`printf 'def\rjkl'` |
pattern=`printf 'def\rjkl'` |
248 |
(cd $srcdir; $valgrind $pcregrep -n --newline=cr -F "$pattern" testNinput) >>testtry |
$valgrind $pcregrep -n --newline=cr -F "$pattern" testNinput >>testtry |
249 |
|
|
250 |
printf "%c--------------------------- Test N4 ------------------------------\r\n" - >>testtry |
printf "%c--------------------------- Test N4 ------------------------------\r\n" - >>testtry |
251 |
pattern=`printf 'xxx\r\njkl'` |
pattern=`printf 'xxx\r\njkl'` |
252 |
(cd $srcdir; $valgrind $pcregrep -n --newline=crlf -F "$pattern" testNinput) >>testtry |
$valgrind $pcregrep -n --newline=crlf -F "$pattern" testNinput >>testtry |
253 |
|
|
254 |
printf "%c--------------------------- Test N5 ------------------------------\r\n" - >>testtry |
printf "%c--------------------------- Test N5 ------------------------------\r\n" - >>testtry |
255 |
(cd $srcdir; $valgrind $pcregrep -n --newline=any "^(abc|def|ghi|jkl)" testNinput) >>testtry |
$valgrind $pcregrep -n --newline=any "^(abc|def|ghi|jkl)" testNinput >>testtry |
256 |
|
|
257 |
printf "%c--------------------------- Test N6 ------------------------------\r\n" - >>testtry |
printf "%c--------------------------- Test N6 ------------------------------\r\n" - >>testtry |
258 |
(cd $srcdir; $valgrind $pcregrep -n --newline=anycrlf "^(abc|def|ghi|jkl)" testNinput) >>testtry |
$valgrind $pcregrep -n --newline=anycrlf "^(abc|def|ghi|jkl)" testNinput >>testtry |
259 |
|
|
260 |
$cf $srcdir/testdata/grepoutputN testtry |
$cf $srcdir/testdata/grepoutputN testtry |
261 |
if [ $? != 0 ] ; then exit 1; fi |
if [ $? != 0 ] ; then exit 1; fi |