6 use Test
::More tests
=> 55;
11 die "Cannot load Data::Peek\n" if $@
; # BAIL_OUT not avail in old Test::More
14 my ($dump, $var) = ("", "");
17 my ($v, $exp, $re) = split m/\t+ */;
24 $v =~ s/^S:([^:]*):// and DDsort
($1), $v =~ m/^()/; # And reset $1 for below
28 ok
($dump = DDumper
($var), "DDumper ($v)");
29 $dump =~ s/\A\$VAR1 = //;
33 like
($dump, qr{$exp}ms, ".. content $re");
34 $1 and diag
"# '$1' (", length ($1), ")\n";
37 is
($dump, $exp, ".. content");
57 [0, 1] ^\[ 0,\n line 1
60 [0,1,2] \A\[\s+0,\n\s+1,\n\s+2\n\s+]\Z line splitting
62 [0] \A\[ 0\n ]\Z single indent
63 [[0],{foo=>1}] ^\[\n outer list
64 ^ {4}\[ 0\n {8}],\n {4} inner list
65 ^ {4}\{ foo {14}=> 1\n {8}}\n inner hash
66 ^ {4}]\Z outer list end
67 [[0],{foo=>1}] \A\[\n {4}\[ 0\n {8}],\n {4}\{ foo {14}=> 1\n {8}}\n {4}]\Z full struct
69 S:1:{ab=>1,bc=>2,cd=>3,de=>13} ab.*bc.*cd.*de default sort
70 S:R:{ab=>1,bc=>2,cd=>3,de=>13} de.*cd.*bc.*ab reverse sort
71 S:V:{ab=>1,bc=>2,cd=>3,de=>13} 1.*13.*2.*3 sort by value
72 S:VR:{ab=>1,bc=>2,cd=>3,de=>13} 3.*2.*13.*1 reverse sort by value
73 S:VN:{ab=>1,bc=>2,cd=>3,de=>13} 1.*2.*3.*13 sort by value numeric
74 S:VNR:{ab=>1,bc=>2,cd=>3,d=>13} 13.*3.*2.*1 reverse sort by value numeric