summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorchpe <chpe@2f5784b3-3f2a-0410-8824-cb99058d5e15>2012-10-27 17:58:30 +0000
committerchpe <chpe@2f5784b3-3f2a-0410-8824-cb99058d5e15>2012-10-27 17:58:30 +0000
commite9e375218e48cb667f8594427f5ba3cf725c97b3 (patch)
tree993367ac3c145ba036041a19648495b1bf6a86f8
parente45619991093e38cd2d1f157ef44f084ece70dd4 (diff)
downloadpcre-e9e375218e48cb667f8594427f5ba3cf725c97b3.tar.gz
tests: Add tests for short UTF-8 and UTF-16
The only preexisting test was accidentally lost in rev 1174. Add exhaustive tests for short UTF-8 and UTF-16. git-svn-id: svn://vcs.exim.org/pcre/code/trunk@1179 2f5784b3-3f2a-0410-8824-cb99058d5e15
-rw-r--r--testdata/testinput1521
-rw-r--r--testdata/testinput246
-rw-r--r--testdata/testoutput1536
-rw-r--r--testdata/testoutput248
4 files changed, 67 insertions, 4 deletions
diff --git a/testdata/testinput15 b/testdata/testinput15
index 6d49c84..c55f3a5 100644
--- a/testdata/testinput15
+++ b/testdata/testinput15
@@ -49,7 +49,7 @@
/ÃÃÃxxx/8?DZSS
-/abc/8
+/badutf/8
\xdf
\xef
\xef\x80
@@ -91,11 +91,28 @@
\xff
\xef\xb7\x90
-/abc/8
+/badutf/8
\xfb\x80\x80\x80\x80
\xfd\x80\x80\x80\x80\x80
\xf7\xbf\xbf\xbf
+/shortutf/8
+ \P\P\xdf
+ \P\P\xef
+ \P\P\xef\x80
+ \P\P\xf7
+ \P\P\xf7\x80
+ \P\P\xf7\x80\x80
+ \P\P\xfb
+ \P\P\xfb\x80
+ \P\P\xfb\x80\x80
+ \P\P\xfb\x80\x80\x80
+ \P\P\xfd
+ \P\P\xfd\x80
+ \P\P\xfd\x80\x80
+ \P\P\xfd\x80\x80\x80
+ \P\P\xfd\x80\x80\x80\x80
+
/anything/8
\xc0\x80
\xc1\x8f
diff --git a/testdata/testinput24 b/testdata/testinput24
index 4cce0ee..bf4eda6 100644
--- a/testdata/testinput24
+++ b/testdata/testinput24
@@ -68,4 +68,10 @@
\x{fdee}
\x{fdef}
+/bad/8
+ \x{d800}
+
+/short/8
+ \P\P\x{d800}
+
/-- End of testinput24 --/
diff --git a/testdata/testoutput15 b/testdata/testoutput15
index ff30e22..9c99da2 100644
--- a/testdata/testoutput15
+++ b/testdata/testoutput15
@@ -84,7 +84,7 @@ Options: utf no_utf_check
First char = \x{c3}
Need char = 'x'
-/abc/8
+/badutf/8
\xdf
Error -10 (bad UTF-8 string) offset=0 reason=1
\xef
@@ -166,7 +166,7 @@ Error -10 (bad UTF-8 string) offset=0 reason=21
\xef\xb7\x90
Error -10 (bad UTF-8 string) offset=0 reason=22
-/abc/8
+/badutf/8
\xfb\x80\x80\x80\x80
Error -10 (bad UTF-8 string) offset=0 reason=11
\xfd\x80\x80\x80\x80\x80
@@ -174,6 +174,38 @@ Error -10 (bad UTF-8 string) offset=0 reason=12
\xf7\xbf\xbf\xbf
Error -10 (bad UTF-8 string) offset=0 reason=13
+/shortutf/8
+ \P\P\xdf
+Error -25 (short UTF-8 string) offset=0 reason=1
+ \P\P\xef
+Error -25 (short UTF-8 string) offset=0 reason=2
+ \P\P\xef\x80
+Error -25 (short UTF-8 string) offset=0 reason=1
+ \P\P\xf7
+Error -25 (short UTF-8 string) offset=0 reason=3
+ \P\P\xf7\x80
+Error -25 (short UTF-8 string) offset=0 reason=2
+ \P\P\xf7\x80\x80
+Error -25 (short UTF-8 string) offset=0 reason=1
+ \P\P\xfb
+Error -25 (short UTF-8 string) offset=0 reason=4
+ \P\P\xfb\x80
+Error -25 (short UTF-8 string) offset=0 reason=3
+ \P\P\xfb\x80\x80
+Error -25 (short UTF-8 string) offset=0 reason=2
+ \P\P\xfb\x80\x80\x80
+Error -25 (short UTF-8 string) offset=0 reason=1
+ \P\P\xfd
+Error -25 (short UTF-8 string) offset=0 reason=5
+ \P\P\xfd\x80
+Error -25 (short UTF-8 string) offset=0 reason=4
+ \P\P\xfd\x80\x80
+Error -25 (short UTF-8 string) offset=0 reason=3
+ \P\P\xfd\x80\x80\x80
+Error -25 (short UTF-8 string) offset=0 reason=2
+ \P\P\xfd\x80\x80\x80\x80
+Error -25 (short UTF-8 string) offset=0 reason=1
+
/anything/8
\xc0\x80
Error -10 (bad UTF-8 string) offset=0 reason=15
diff --git a/testdata/testoutput24 b/testdata/testoutput24
index 78d1290..bf58abb 100644
--- a/testdata/testoutput24
+++ b/testdata/testoutput24
@@ -134,4 +134,12 @@ Error -10 (bad UTF-16 string) offset=0 reason=4
\x{fdef}
Error -10 (bad UTF-16 string) offset=0 reason=4
+/bad/8
+ \x{d800}
+Error -10 (bad UTF-16 string) offset=0 reason=1
+
+/short/8
+ \P\P\x{d800}
+Error -25 (short UTF-16 string) offset=0 reason=1
+
/-- End of testinput24 --/