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 | |
e6746e64 |
17 | DWARNL: { |
18 | my @foo = DwarnL 'warn', 'friend'; |
19 | is $warned_string,qq{"warn"\n"friend"\n}, 'DwarnL warns'; |
884bc377 |
20 | |
e6746e64 |
21 | ok eq_array(\@foo, ['warn','friend']), 'DwarnL passes through correctly'; |
22 | } |
23 | |
24 | DWARNS: { |
25 | my $bar = DwarnS 'robot',2,3; |
26 | is $warned_string,qq{"robot"\n}, 'DwarnS warns'; |
27 | is $bar, 'robot', 'DwarnS passes through correctly'; |
28 | } |
caf571f8 |
29 | |
e6746e64 |
30 | DWARN: { |
31 | my @foo = Dwarn 'warn', 'friend'; |
32 | is $warned_string,qq{"warn"\n"friend"\n}, 'Dwarn warns lists'; |
33 | |
34 | ok eq_array(\@foo, ['warn','friend']), 'Dwarn passes lists through correctly'; |
35 | |
36 | my $bar = Dwarn 'robot',2,3; |
37 | is $warned_string,qq{"robot"\n}, 'Dwarn warns scalars correctly'; |
38 | is $bar, 'robot', 'Dwarn passes scalars through correctly'; |
39 | } |