From: Arthur Axel 'fREW' Schmidt Date: Sun, 14 Feb 2010 08:22:01 +0000 (-0600) Subject: sugar! X-Git-Tag: v0.00100~33 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=d145d900af1cb12838937286f0e5bfa758fefa3f;p=p5sagit%2FLog-Contextual.git sugar! --- diff --git a/t/sugar.t b/t/sugar.t new file mode 100644 index 0000000..1008b03 --- /dev/null +++ b/t/sugar.t @@ -0,0 +1,30 @@ +use strict; +use warnings; + +use lib 't/lib'; +use VarLogger; +use Test::More 'no_plan'; + +use Log::Contextual; +use Log::Contextual::Sugar; + +my $var_log = VarLogger->new; + +set_logger(sub { $var_log }); +my @foo = Dlog_debug { "Look ma, data: $_" } qw{frew bar baz}; +ok( eq_array(\@foo, [qw{frew bar baz}]), 'Dlog_debug passes data through correctly'); +is( $var_log->var, <<'OUT', 'Output for Dlog_debug is correct'); +Look ma, data: "frew" +"bar" +"baz" +OUT +my $bar = DlogS_debug { "Look ma, data: $_" } [qw{frew bar baz}]; +ok( eq_array($bar, [qw{frew bar baz}]), 'DlogS_debug passes data through correctly'); +is( $var_log->var, <<'OUT', 'Output for DlogS_debug is correct'); +Look ma, data: [ + "frew", + "bar", + "baz" +] +OUT +