summaryrefslogtreecommitdiff
path: root/dist/Exporter
diff options
context:
space:
mode:
authorTony Cook <tony@develop-help.com>2013-07-18 16:02:29 +1000
committerTony Cook <tony@develop-help.com>2013-07-26 10:59:05 +1000
commit0fe08b2b23c9e50663374a37f787ff18c914b79f (patch)
tree596658694e4ad9dcd314378317a219094260c52f /dist/Exporter
parent9617fa1ef1efc315796404f56adfda451b173a44 (diff)
downloadperl-0fe08b2b23c9e50663374a37f787ff18c914b79f.tar.gz
[perl #39739] TODO test for Exporter respecting warning handlers
Diffstat (limited to 'dist/Exporter')
-rw-r--r--dist/Exporter/t/warn.t39
1 files changed, 39 insertions, 0 deletions
diff --git a/dist/Exporter/t/warn.t b/dist/Exporter/t/warn.t
new file mode 100644
index 0000000000..49a109cec4
--- /dev/null
+++ b/dist/Exporter/t/warn.t
@@ -0,0 +1,39 @@
+#!perl -w
+
+# Can't use Test::Simple/More, they depend on Exporter.
+my $test;
+sub ok ($;$) {
+ my($ok, $name) = @_;
+
+ # You have to do it this way or VMS will get confused.
+ printf "%sok %d%s\n", ($ok ? '' : 'not '), $test,
+ (defined $name ? " - $name" : '');
+
+ printf "# Failed test at line %d\n", (caller)[2] unless $ok;
+
+ $test++;
+ return $ok;
+}
+
+
+BEGIN {
+ $test = 1;
+ print "1..2\n";
+ require Exporter;
+ ok( 1, 'Exporter compiled' );
+}
+
+package Foo;
+Exporter->import("import");
+@EXPORT_OK = "bar";
+
+package main;
+
+{ # [perl #39739] Exporter::Heavy ignores custom $SIG{__WARN__} handlers
+ my @warn;
+
+ local $SIG{__WARN__} = sub { push @warn, join "", @_ };
+ eval { Foo->import(":quux") };
+ ok(grep(/"quux" is not defined/, @warn), "# TODO warnings captured");
+}
+