Commit | Line | Data |
884bc377 |
1 | use strict; |
2 | use warnings; |
3 | use Data::Dumper::Concise::Sugar; |
4 | |
5 | use Data::Dumper::Concise (); |
6 | |
7 | use Test::More qw(no_plan); |
884bc377 |
8 | |
caf571f8 |
9 | my $warned_string; |
884bc377 |
10 | |
caf571f8 |
11 | BEGIN { |
12 | $SIG{'__WARN__'} = sub { |
13 | $warned_string = $_[0] |
14 | } |
15 | } |
884bc377 |
16 | |
caf571f8 |
17 | my @foo = Dwarn 'warn', 'friend'; |
18 | is $warned_string,qq{"warn"\n"friend"\n}, 'Dwarn warns'; |
884bc377 |
19 | |
caf571f8 |
20 | ok eq_array(\@foo, ['warn','friend']), 'Dwarn passes through correctly'; |
21 | |
22 | my $bar = DwarnS 'robot',2,3; |
23 | is $warned_string,qq{"robot"\n}, 'DwarnS warns'; |
884bc377 |
24 | is $bar, 'robot', 'DwarnS passes through correctly'; |