File: usage.t

package info (click to toggle)
libdata-dump-streamer-perl 2.42-2
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 828 kB
  • sloc: perl: 3,206; makefile: 3
file content (28 lines) | stat: -rw-r--r-- 830 bytes parent folder | download | duplicates (2)
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;
}