| 15 |
# itself. What we are checking here is the file handling and options that are |
# itself. What we are checking here is the file handling and options that are |
| 16 |
# supported by pcregrep. |
# supported by pcregrep. |
| 17 |
|
|
| 18 |
cf="diff -u" |
cf="diff -ub" |
| 19 |
valgrind= |
valgrind= |
| 20 |
if [ ! -d testdata ] ; then |
if [ ! -d testdata ] ; then |
| 21 |
ln -s @top_srcdir@/testdata testdata |
ln -s @top_srcdir@/testdata testdata |
| 197 |
echo "---------------------------- Test 49 ------------------------------" >>testtry |
echo "---------------------------- Test 49 ------------------------------" >>testtry |
| 198 |
$valgrind ./pcregrep "^(abc|def|ghi|jkl)" $testdata/grepinputx >>testtry |
$valgrind ./pcregrep "^(abc|def|ghi|jkl)" $testdata/grepinputx >>testtry |
| 199 |
|
|
|
echo "---------------------------- Test 50 ------------------------------" >>testtry |
|
|
$valgrind ./pcregrep -N CR "^(abc|def|ghi|jkl)" $testdata/grepinputx >>testtry |
|
|
|
|
|
echo "---------------------------- Test 51 ------------------------------" >>testtry |
|
|
$valgrind ./pcregrep --newline=crlf "^(abc|def|ghi|jkl)" $testdata/grepinputx >>testtry |
|
|
|
|
|
echo "---------------------------- Test 52 ------------------------------" >>testtry |
|
|
pattern=`printf 'def\rjkl'` |
|
|
$valgrind ./pcregrep --newline=cr -F "$pattern" $testdata/grepinputx >>testtry |
|
|
|
|
|
echo "---------------------------- Test 53 ------------------------------" >>testtry |
|
|
pattern=`printf 'xxx\r\njkl'` |
|
|
$valgrind ./pcregrep --newline=crlf -F "$pattern" $testdata/grepinputx >>testtry |
|
|
|
|
|
echo "---------------------------- Test 54 ------------------------------" >>testtry |
|
|
$valgrind ./pcregrep -n --newline=any "^(abc|def|ghi|jkl)" $testdata/grepinputx >>testtry |
|
|
|
|
| 200 |
# Now compare the results. |
# Now compare the results. |
| 201 |
|
|
| 202 |
$cf testtry $testdata/grepoutput |
$cf testtry $testdata/grepoutput |
| 203 |
if [ $? != 0 ] ; then exit 1; fi |
if [ $? != 0 ] ; then exit 1; fi |
| 204 |
|
|
| 205 |
|
|
| 206 |
# These tests require UTF-8 support |
# These tests require UTF-8 support |
| 207 |
|
|
| 208 |
if [ $utf8 -ne 0 ] ; then |
if [ $utf8 -ne 0 ] ; then |
| 221 |
echo "Skipping pcregrep UTF-8 tests: no UTF-8 support in PCRE library" |
echo "Skipping pcregrep UTF-8 tests: no UTF-8 support in PCRE library" |
| 222 |
fi |
fi |
| 223 |
|
|
| 224 |
|
|
| 225 |
|
# The tests for various newline values may not work in environments where |
| 226 |
|
# the newlines in the files are not \n. |
| 227 |
|
|
| 228 |
|
echo "Testing pcregrep newline settings" |
| 229 |
|
|
| 230 |
|
echo "---------------------------- Test N1 ------------------------------" >testtry |
| 231 |
|
$valgrind ./pcregrep -N CR "^(abc|def|ghi|jkl)" $testdata/grepinputx >>testtry |
| 232 |
|
|
| 233 |
|
echo "---------------------------- Test N2 ------------------------------" >>testtry |
| 234 |
|
$valgrind ./pcregrep --newline=crlf "^(abc|def|ghi|jkl)" $testdata/grepinputx >>testtry |
| 235 |
|
|
| 236 |
|
echo "---------------------------- Test N3 ------------------------------" >>testtry |
| 237 |
|
pattern=`printf 'def\rjkl'` |
| 238 |
|
$valgrind ./pcregrep --newline=cr -F "$pattern" $testdata/grepinputx >>testtry |
| 239 |
|
|
| 240 |
|
echo "---------------------------- Test n$ ------------------------------" >>testtry |
| 241 |
|
pattern=`printf 'xxx\r\njkl'` |
| 242 |
|
$valgrind ./pcregrep --newline=crlf -F "$pattern" $testdata/grepinputx >>testtry |
| 243 |
|
|
| 244 |
|
echo "---------------------------- Test N5 ------------------------------" >>testtry |
| 245 |
|
$valgrind ./pcregrep -n --newline=any "^(abc|def|ghi|jkl)" $testdata/grepinputx >>testtry |
| 246 |
|
|
| 247 |
|
$cf testtry $testdata/grepoutputN |
| 248 |
|
if [ $? != 0 ] ; then exit 1; fi |
| 249 |
|
|
| 250 |
exit 0 |
exit 0 |
| 251 |
|
|
| 252 |
# End |
# End |