From: Arthur Axel 'fREW' Schmidt Date: Wed, 9 Dec 2009 01:40:48 +0000 (-0600) Subject: actual tests for Sugar X-Git-Tag: v2.000~15 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=p5sagit%2FData-Dumper-Concise.git;a=commitdiff_plain;h=caf571f8c4f3eadce186d1f01fd69f9858ea11ba actual tests for Sugar --- diff --git a/t/sugar.t b/t/sugar.t index 280f44d..4ca2ecc 100644 --- a/t/sugar.t +++ b/t/sugar.t @@ -5,18 +5,20 @@ use Data::Dumper::Concise::Sugar; use Data::Dumper::Concise (); use Test::More qw(no_plan); -use Test::Warn; -my @foo; -warnings_like { - @foo = Dwarn 'warn', 'friend'; -} [qr/"warn"/,qr/friend/], "Dwarn warns"; +my $warned_string; -ok eq_array(\@foo, ['warn']), 'Dwarn passes through correctly'; +BEGIN { + $SIG{'__WARN__'} = sub { + $warned_string = $_[0] + } +} -my $bar; -warning_like { - $bar = DwarnS 'robot',2,3; -} qr{^"robot"$}, "DwarnS warns"; +my @foo = Dwarn 'warn', 'friend'; +is $warned_string,qq{"warn"\n"friend"\n}, 'Dwarn warns'; +ok eq_array(\@foo, ['warn','friend']), 'Dwarn passes through correctly'; + +my $bar = DwarnS 'robot',2,3; +is $warned_string,qq{"robot"\n}, 'DwarnS warns'; is $bar, 'robot', 'DwarnS passes through correctly';