eliminate done_testing
[p5sagit/Import-Into.git] / t / import_into.t
CommitLineData
2afb5246 1use strict;
2use warnings FATAL => 'all';
1615d435 3use Test::More qw(no_plan);
2afb5246 4
5BEGIN {
6
7 package MyExporter;
8
9 use base qw(Exporter);
10
11 our @EXPORT_OK = qw(thing);
12
13 sub thing { 'thing' }
14
15 package MultiExporter;
16
17 use Import::Into;
18
19 sub import {
20 my $target = caller;
21 warnings->import::into($target);
22 MyExporter->import::into($target, 'thing');
23 }
24
25 $INC{"MultiExporter.pm"} = 1;
26}
27
28BEGIN {
29
30 package TestPackage;
31
32 no warnings;
33
34 use MultiExporter;
35
36 sub test {
37 thing . undef
38 }
39}
40
41my @w;
42
43is(do {
44 local $SIG{__WARN__} = sub { push @w, @_; };
45 TestPackage::test;
46}, 'thing', 'returned thing ok');
47
48is(scalar @w, 1, 'Only one entry in @w');
49
50like($w[0], qr/uninitialized/, 'Correct warning');