File: usage.t

package info (click to toggle)
libdata-dump-streamer-perl 2.08-40-2
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 408 kB
  • ctags: 101
  • sloc: perl: 2,669; makefile: 51
file content (32 lines) | stat: -rwxr-xr-x 903 bytes parent folder | download
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
29
30
31
32
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;
}    

#$Id: usage.t 26 2006-04-16 15:18:52Z demerphq $#