Add test for [perl #87812]
authorKarl Williamson <public@khwilliamson.com>
Mon, 11 Apr 2011 18:11:06 +0000 (12:11 -0600)
committerKarl Williamson <public@khwilliamson.com>
Mon, 11 Apr 2011 18:16:36 +0000 (12:16 -0600)
This makes sure that no case insensitive match of a Latin1 character
causes the utf8_heavy code to be loaded.

MANIFEST
t/re/no_utf8_pm.t [new file with mode: 0644]

index 27a9e75..0e02719 100644 (file)
--- a/MANIFEST
+++ b/MANIFEST
@@ -5022,6 +5022,7 @@ t/porting/test_bootstrap.t        Test that the instructions for test bootstrapping are
 t/README                       Instructions for regression tests
 t/re/charset.t                 See if regex modifiers like /d, /u work properly
 t/re/fold_grind.t              See if case folding works properly
+t/re/no_utf8_pm.t              Verify utf8.pm doesn't get loaded unless required
 t/re/overload.t                Test against string corruption in pattern matches on overloaded objects
 t/re/pat_advanced.t            See if advanced esoteric patterns work
 t/re/pat_advanced_thr.t                See if advanced esoteric patterns work in another thread
diff --git a/t/re/no_utf8_pm.t b/t/re/no_utf8_pm.t
new file mode 100644 (file)
index 0000000..8d49751
--- /dev/null
@@ -0,0 +1,12 @@
+#!./perl
+
+print "1..1\n";
+
+# Make sure that case-insensitive matching of any Latin1 chars don't load
+# utf8.pm.  We assume that NULL won't force loading utf8.pm, and since it
+# doesn't match any of the other chars, the regexec.c code would try to load
+# a swash if it thought there was one.
+"\0" =~ /[\001-\xFF]/i;
+
+print "not" if exists $INC{"utf8.pm"};
+print "ok 1\n";