1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
|
our (@tests, $x, $obj, @list, $string);
BEGIN {
@tests= (
'Dump($x);',
'$obj=Dump(); ref $obj eq "Data::Dump::Streamer"',
'$obj=Dump($x); ref $obj eq "Data::Dump::Streamer"',
'$obj=Dump($x)->Purity(0); ref $obj eq "Data::Dump::Streamer"',
'@list=$obj->Dump; @list>0',
'$obj->Purity()==0',
'$string=$obj->Dump($x)->Out(); $string =~/1,/',
'$string=$obj->Names("foo")->Data($x)->Dump(); $string =~/1,/ && $string=~/foo/',
);
}
use Test::More tests => 1 + @tests;
BEGIN { use_ok('Data::Dump::Streamer', qw(:undump Dump)); }
use strict;
use warnings;
$obj= "";
$x= [ 1 .. 10 ];
for my $snippet (@tests) {
my ($title)= split /;/, $snippet;
@list= ();
$string= "";
ok(eval($snippet) && !$@, $title)
or diag @list ? "[@list]" : $string;
}
|