X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Fsugar.t;h=8c1dba003345c77525e1aca11bd522ebf53b556b;hb=452e7ff29c95f7771bf5efd31c24cfb6f2d7b2bb;hp=737541504d6a3d909ff6c743d9a694d4403aa705;hpb=e6746e6495d3aae4e1f13f763a5ab2c39682fde1;p=p5sagit%2FData-Dumper-Concise.git diff --git a/t/sugar.t b/t/sugar.t index 7375415..8c1dba0 100644 --- a/t/sugar.t +++ b/t/sugar.t @@ -37,3 +37,25 @@ DWARN: { is $warned_string,qq{"robot"\n}, 'Dwarn warns scalars correctly'; is $bar, 'robot', 'Dwarn passes scalars through correctly'; } + +DWARN_CODEREF: { + my $foo = ['warn', 'friend']->$Dwarn; + is $warned_string,qq{[\n "warn",\n "friend"\n]\n}, 'Dwarn warns lists'; + + ok eq_array($foo, ['warn','friend']), 'Dwarn passes lists through correctly'; +} + +DWARNN: { + my $loaded = eval { require Devel::ArgNames; 1 }; + if ($loaded) { + my $x = [1]; + my $foo = DwarnN $x; + is $warned_string, qq{\$x => [\n 1\n]\n}, 'DwarnN warns'; + + ok eq_array($foo, [1]), 'DwarnN passes through correctly'; + + DwarnN [1]; + is $warned_string, qq{(anon) => [\n 1\n]\n}, 'DwarnN warns'; + } +} +