Revision: 1179
http://vcs.pcre.org/viewvc?view=rev&revision=1179
Author: chpe
Date: 2012-10-27 18:58:30 +0100 (Sat, 27 Oct 2012)
Log Message:
-----------
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.
Revision Links:
--------------
http://vcs.pcre.org/viewvc?view=rev&revision=1174
Modified Paths:
--------------
code/trunk/testdata/testinput15
code/trunk/testdata/testinput24
code/trunk/testdata/testoutput15
code/trunk/testdata/testoutput24
Modified: code/trunk/testdata/testinput15
===================================================================
--- code/trunk/testdata/testinput15 2012-10-27 16:49:31 UTC (rev 1178)
+++ code/trunk/testdata/testinput15 2012-10-27 17:58:30 UTC (rev 1179)
@@ -49,7 +49,7 @@
/\xC3\xC3\xC3xxx/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
Modified: code/trunk/testdata/testinput24
===================================================================
--- code/trunk/testdata/testinput24 2012-10-27 16:49:31 UTC (rev 1178)
+++ code/trunk/testdata/testinput24 2012-10-27 17:58:30 UTC (rev 1179)
@@ -68,4 +68,10 @@
\x{fdee}
\x{fdef}
+/bad/8
+ \x{d800}
+
+/short/8
+ \P\P\x{d800}
+
/-- End of testinput24 --/
Modified: code/trunk/testdata/testoutput15
===================================================================
--- code/trunk/testdata/testoutput15 2012-10-27 16:49:31 UTC (rev 1178)
+++ code/trunk/testdata/testoutput15 2012-10-27 17:58:30 UTC (rev 1179)
@@ -84,7 +84,7 @@
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 @@
\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 @@
\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
Modified: code/trunk/testdata/testoutput24
===================================================================
--- code/trunk/testdata/testoutput24 2012-10-27 16:49:31 UTC (rev 1178)
+++ code/trunk/testdata/testoutput24 2012-10-27 17:58:30 UTC (rev 1179)
@@ -134,4 +134,12 @@
\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 --/