summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorph10 <ph10@2f5784b3-3f2a-0410-8824-cb99058d5e15>2007-05-01 10:30:14 +0000
committerph10 <ph10@2f5784b3-3f2a-0410-8824-cb99058d5e15>2007-05-01 10:30:14 +0000
commitbe4e5a1d64512d389d3a1663a60e063d0e7d3d22 (patch)
tree20497fef089b5ab4ea55779db75442d90f2c4d8b
parenta840aa4093cc50cb88bf898be0f28232bca31bec (diff)
downloadpcre-be4e5a1d64512d389d3a1663a60e063d0e7d3d22.tar.gz
More test updates.
git-svn-id: svn://vcs.exim.org/pcre/code/trunk@158 2f5784b3-3f2a-0410-8824-cb99058d5e15
-rw-r--r--ChangeLog3
-rwxr-xr-xRunGrepTest38
-rwxr-xr-xRunTest18
-rw-r--r--testdata/grepinputx6
-rw-r--r--testdata/grepoutput27
-rw-r--r--testdata/grepoutputN39
6 files changed, 53 insertions, 78 deletions
diff --git a/ChangeLog b/ChangeLog
index 48438a9..cd01b68 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -6,6 +6,9 @@ Version 7.2 01-May-07
1. If the fr_FR locale cannot be found for test 3, try the "french" locale,
which is apparently normally available under Windows.
+
+ 2. Re-jig the pcregrep tests with different newline settings in an attempt
+ to make them independent of the local environment's newline setting.
Version 7.1 24-Apr-07
diff --git a/RunGrepTest b/RunGrepTest
index 0996e68..961430a 100755
--- a/RunGrepTest
+++ b/RunGrepTest
@@ -204,7 +204,7 @@ echo "---------------------------- Test 49 ------------------------------" >>tes
# Now compare the results.
-$cf testtry $srcdir/testdata/grepoutput
+$cf $srcdir/testdata/grepoutput testtry
if [ $? != 0 ] ; then exit 1; fi
@@ -219,7 +219,7 @@ if [ $utf8 -ne 0 ] ; then
echo "---------------------------- Test U2 ------------------------------" >>testtry
(cd $srcdir; $valgrind $pcregrep -n -u -C 3 --newline=any "Match" ./testdata/grepinput8) >>testtry
- $cf testtry $srcdir/testdata/grepoutput8
+ $cf $srcdir/testdata/grepoutput8 testtry
if [ $? != 0 ] ; then exit 1; fi
else
@@ -227,32 +227,36 @@ else
fi
-# The tests for various newline values may not work in environments where
-# the newlines in the files are not \n.
+# We go to some contortions to try to ensure that the tests for the various
+# newline settings will work in environments where the normal newline sequence
+# is not \n. Note the messy fudge to get printf to write a string that starts
+# with a hyphen.
echo "Testing pcregrep newline settings"
-echo "---------------------------- Test N1 ------------------------------" >testtry
-(cd $srcdir; $valgrind $pcregrep -N CR "^(abc|def|ghi|jkl)" ./testdata/grepinputx) >>testtry
+printf "abc\rdef\r\nghi\njkl" >$srcdir/testNinput
-echo "---------------------------- Test N2 ------------------------------" >>testtry
-(cd $srcdir; $valgrind $pcregrep --newline=crlf "^(abc|def|ghi|jkl)" ./testdata/grepinputx) >>testtry
+printf "%c--------------------------- Test N1 ------------------------------\r\n" - >testtry
+(cd $srcdir; $valgrind $pcregrep -n -N CR "^(abc|def|ghi|jkl)" testNinput) >>testtry
-echo "---------------------------- Test N3 ------------------------------" >>testtry
+printf "%c--------------------------- Test N2 ------------------------------\r\n" - >>testtry
+(cd $srcdir; $valgrind $pcregrep -n --newline=crlf "^(abc|def|ghi|jkl)" testNinput) >>testtry
+
+printf "%c--------------------------- Test N3 ------------------------------\r\n" - >>testtry
pattern=`printf 'def\rjkl'`
-(cd $srcdir; $valgrind $pcregrep --newline=cr -F "$pattern" ./testdata/grepinputx) >>testtry
+(cd $srcdir; $valgrind $pcregrep -n --newline=cr -F "$pattern" testNinput) >>testtry
-echo "---------------------------- Test N4 ------------------------------" >>testtry
+printf "%c--------------------------- Test N4 ------------------------------\r\n" - >>testtry
pattern=`printf 'xxx\r\njkl'`
-(cd $srcdir; $valgrind $pcregrep --newline=crlf -F "$pattern" ./testdata/grepinputx) >>testtry
+(cd $srcdir; $valgrind $pcregrep -n --newline=crlf -F "$pattern" testNinput) >>testtry
-echo "---------------------------- Test N5 ------------------------------" >>testtry
-(cd $srcdir; $valgrind $pcregrep -n --newline=any "^(abc|def|ghi|jkl)" ./testdata/grepinputx) >>testtry
+printf "%c--------------------------- Test N5 ------------------------------\r\n" - >>testtry
+(cd $srcdir; $valgrind $pcregrep -n --newline=any "^(abc|def|ghi|jkl)" testNinput) >>testtry
-echo "---------------------------- Test N6 ------------------------------" >>testtry
-(cd $srcdir; $valgrind $pcregrep -n --newline=anycrlf "^(abc|def|ghi|jkl)" ./testdata/grepinputx) >>testtry
+printf "%c--------------------------- Test N6 ------------------------------\r\n" - >>testtry
+(cd $srcdir; $valgrind $pcregrep -n --newline=anycrlf "^(abc|def|ghi|jkl)" testNinput) >>testtry
-$cf testtry $srcdir/testdata/grepoutputN
+$cf $srcdir/testdata/grepoutputN testtry
if [ $? != 0 ] ; then exit 1; fi
exit 0
diff --git a/RunTest b/RunTest
index 550f283..53ecffe 100755
--- a/RunTest
+++ b/RunTest
@@ -132,7 +132,7 @@ if [ $do1 = yes ] ; then
echo "Test 1: main functionality (Perl compatible)"
$valgrind ./pcretest -q $testdata/testinput1 testtry
if [ $? = 0 ] ; then
- $cf testtry $testdata/testoutput1
+ $cf $testdata/testoutput1 testtry
if [ $? != 0 ] ; then exit 1; fi
else exit 1
fi
@@ -146,7 +146,7 @@ if [ $do2 = yes ] ; then
echo "Test 2: API and error handling (not Perl compatible)"
$valgrind ./pcretest -q $testdata/testinput2 testtry
if [ $? = 0 ] ; then
- $cf testtry $testdata/testoutput2
+ $cf $testdata/testoutput2 testtry
if [ $? != 0 ] ; then exit 1; fi
else exit 1
fi
@@ -184,7 +184,7 @@ if [ $do3 = yes ] ; then
echo "Test 3: locale-specific features (using '$locale' locale)"
$valgrind ./pcretest -q $infile testtry
if [ $? = 0 ] ; then
- $cf testtry $outfile
+ $cf $outfile testtry
if [ $? != 0 ] ; then
echo " "
echo "Locale test did not run entirely successfully."
@@ -209,7 +209,7 @@ if [ $do4 = yes ] ; then
echo "Test 4: UTF-8 support (Perl compatible)"
$valgrind ./pcretest -q $testdata/testinput4 testtry
if [ $? = 0 ] ; then
- $cf testtry $testdata/testoutput4
+ $cf $testdata/testoutput4 testtry
if [ $? != 0 ] ; then exit 1; fi
else exit 1
fi
@@ -221,7 +221,7 @@ if [ $do5 = yes ] ; then
echo "Test 5: API and internals for UTF-8 support (not Perl compatible)"
$valgrind ./pcretest -q $testdata/testinput5 testtry
if [ $? = 0 ] ; then
- $cf testtry $testdata/testoutput5
+ $cf $testdata/testoutput5 testtry
if [ $? != 0 ] ; then exit 1; fi
else exit 1
fi
@@ -237,7 +237,7 @@ if [ $do6 = yes ] ; then
echo "Test 6: Unicode property support"
$valgrind ./pcretest -q $testdata/testinput6 testtry
if [ $? = 0 ] ; then
- $cf testtry $testdata/testoutput6
+ $cf $testdata/testoutput6 testtry
if [ $? != 0 ] ; then exit 1; fi
else exit 1
fi
@@ -254,7 +254,7 @@ if [ $do7 = yes ] ; then
echo "Test 7: DFA matching"
$valgrind ./pcretest -q -dfa $testdata/testinput7 testtry
if [ $? = 0 ] ; then
- $cf testtry $testdata/testoutput7
+ $cf $testdata/testoutput7 testtry
if [ $? != 0 ] ; then exit 1; fi
else exit 1
fi
@@ -265,7 +265,7 @@ if [ $do8 = yes ] ; then
echo "Test 8: DFA matching with UTF-8"
$valgrind ./pcretest -q -dfa $testdata/testinput8 testtry
if [ $? = 0 ] ; then
- $cf testtry $testdata/testoutput8
+ $cf $testdata/testoutput8 testtry
if [ $? != 0 ] ; then exit 1; fi
else exit 1
fi
@@ -276,7 +276,7 @@ if [ $do9 = yes ] ; then
echo "Test 9: DFA matching with Unicode properties"
$valgrind ./pcretest -q -dfa $testdata/testinput9 testtry
if [ $? = 0 ] ; then
- $cf testtry $testdata/testoutput9
+ $cf $testdata/testoutput9 testtry
if [ $? != 0 ] ; then exit 1; fi
else exit 1
fi
diff --git a/testdata/grepinputx b/testdata/grepinputx
index 296ed4c..aebba02 100644
--- a/testdata/grepinputx
+++ b/testdata/grepinputx
@@ -39,10 +39,4 @@ eighteen
nineteen
twenty
-Here follows some CR/LF/CRLF test data.
-
-abc def
-ghi
-jkl
-
This is the last line of this file.
diff --git a/testdata/grepoutput b/testdata/grepoutput
index 4424812..2e8cdc7 100644
--- a/testdata/grepoutput
+++ b/testdata/grepoutput
@@ -75,13 +75,7 @@ RC=1
39:nineteen
40:twenty
41:
-42:Here follows some CR/LF/CRLF test data.
-43:
-44:abc def
-45:ghi
-46:jkl
-47:
-48:This is the last line of this file.
+42:This is the last line of this file.
---------------------------- Test 12 -----------------------------
Pattern
---------------------------- Test 13 -----------------------------
@@ -163,8 +157,7 @@ eighteen
nineteen
twenty
-Here follows some CR/LF/CRLF test data.
-
+This is the last line of this file.
---------------------------- Test 25 -----------------------------
15-
16-complete pair
@@ -214,8 +207,7 @@ eighteen
nineteen
twenty
-Here follows some CR/LF/CRLF test data.
-
+This is the last line of this file.
---------------------------- Test 27 -----------------------------
four
five
@@ -235,9 +227,7 @@ eighteen
nineteen
twenty
-Here follows some CR/LF/CRLF test data.
-
-abc def
+This is the last line of this file.
---------------------------- Test 28 -----------------------------
14-of lines all by themselves.
15-
@@ -289,11 +279,7 @@ eighteen
nineteen
twenty
-Here follows some CR/LF/CRLF test data.
-
-abc def
-ghi
-jkl
+This is the last line of this file.
---------------------------- Test 30 -----------------------------
./testdata/grepinput-4-features should be added at the end, because some of the tests involve the
./testdata/grepinput-5-output of line numbers, and we don't want these to change.
@@ -397,6 +383,3 @@ AB.VE
AB.VE the turtle
PUT NEW DATA ABOVE THIS LINE.
---------------------------- Test 49 ------------------------------
-abc def
-ghi
-jkl
diff --git a/testdata/grepoutputN b/testdata/grepoutputN
index b0a27c6..1f9f880 100644
--- a/testdata/grepoutputN
+++ b/testdata/grepoutputN
@@ -1,25 +1,16 @@
----------------------------- Test N1 ------------------------------
-def ---------------------------- Test N2 ------------------------------
+---------------------------- Test N1 ------------------------------
+1:abc 2:def ---------------------------- Test N2 ------------------------------
+1:abc def
+2:ghi
+jkl---------------------------- Test N3 ------------------------------
+2:def 3:
ghi
-jkl
-
-This is the last line of this file.
----------------------------- Test N3 ------------------------------
-def
-ghi
-jkl
-
-This is the last line of this file.
----------------------------- Test N4 ------------------------------
-ghi
-jkl
-
-This is the last line of this file.
----------------------------- Test N5 ------------------------------
-44:abc 45:def
-46:ghi
-47:jkl
----------------------------- Test N6 ------------------------------
-44:abc 45:def
-46:ghi
-47:jkl
+jkl---------------------------- Test N4 ------------------------------
+2:ghi
+jkl---------------------------- Test N5 ------------------------------
+1:abc 2:def
+3:ghi
+4:jkl---------------------------- Test N6 ------------------------------
+1:abc 2:def
+3:ghi
+4:jkl \ No newline at end of file