summaryrefslogtreecommitdiff
path: root/t/pragma/warn/utf8
diff options
context:
space:
mode:
Diffstat (limited to 't/pragma/warn/utf8')
-rw-r--r--t/pragma/warn/utf856
1 files changed, 56 insertions, 0 deletions
diff --git a/t/pragma/warn/utf8 b/t/pragma/warn/utf8
new file mode 100644
index 0000000000..380d53bbcc
--- /dev/null
+++ b/t/pragma/warn/utf8
@@ -0,0 +1,56 @@
+
+ utf8.c AOK
+
+ All Mandatory warnings
+
+ [utf8_to_uv]
+ Malformed UTF-8 character
+ my $a = ord "\x80" ;
+
+ Malformed UTF-8 character
+ my $a = ord "\xf080" ;
+
+ [utf16_to_utf8]
+ Malformed UTF-16 surrogate
+ <<<<<< Add a test when somethig actually calls utf16_to_utf8
+
+__END__
+# utf8.c
+use utf8 ;
+my $a = ord "\x80" ;
+EXPECT
+Malformed UTF-8 character at - line 3.
+########
+# utf8.c
+use utf8 ;
+my $a = ord "\x80" ;
+{
+ use warning 'utf8' ;
+ my $a = ord "\x80" ;
+ no warning 'utf8' ;
+ my $a = ord "\x80" ;
+}
+EXPECT
+Malformed UTF-8 character at - line 3.
+\x80 will produce malformed UTF-8 character; use \x{80} for that at - line 6.
+Malformed UTF-8 character at - line 6.
+########
+# utf8.c
+use utf8 ;
+my $a = ord "\xf080" ;
+EXPECT
+Malformed UTF-8 character at - line 3.
+########
+# utf8.c
+use utf8 ;
+my $a = ord "\xf080" ;
+{
+ use warning 'utf8' ;
+ my $a = ord "\xf080" ;
+ no warning 'utf8' ;
+ my $a = ord "\xf080" ;
+}
+EXPECT
+Malformed UTF-8 character at - line 3.
+\xf0 will produce malformed UTF-8 character; use \x{f0} for that at - line 6.
+Malformed UTF-8 character at - line 6.