Commit | Line | Data |
---|---|---|
0fe08b2b TC |
1 | #!perl -w |
2 | ||
3 | # Can't use Test::Simple/More, they depend on Exporter. | |
4 | my $test; | |
5 | sub ok ($;$) { | |
6 | my($ok, $name) = @_; | |
7 | ||
8 | # You have to do it this way or VMS will get confused. | |
9 | printf "%sok %d%s\n", ($ok ? '' : 'not '), $test, | |
10 | (defined $name ? " - $name" : ''); | |
11 | ||
12 | printf "# Failed test at line %d\n", (caller)[2] unless $ok; | |
13 | ||
14 | $test++; | |
15 | return $ok; | |
16 | } | |
17 | ||
18 | ||
19 | BEGIN { | |
20 | $test = 1; | |
21 | print "1..2\n"; | |
22 | require Exporter; | |
23 | ok( 1, 'Exporter compiled' ); | |
24 | } | |
25 | ||
26 | package Foo; | |
27 | Exporter->import("import"); | |
28 | @EXPORT_OK = "bar"; | |
29 | ||
30 | package main; | |
31 | ||
32 | { # [perl #39739] Exporter::Heavy ignores custom $SIG{__WARN__} handlers | |
33 | my @warn; | |
34 | ||
35 | local $SIG{__WARN__} = sub { push @warn, join "", @_ }; | |
36 | eval { Foo->import(":quux") }; | |
d7d11da6 | 37 | ok(grep(/"quux" is not defined/, @warn), "warnings captured"); |
0fe08b2b TC |
38 | } |
39 |