File: 60identity.t

package info (click to toggle)
libvcp-perl 0.9-20041020-1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 1,608 kB
  • ctags: 833
  • sloc: perl: 18,190; sh: 11
file content (67 lines) | stat: -rw-r--r-- 1,391 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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#!/usr/local/bin/perl -w

=head1 NAME

identity.t - test VCP::Filter::identity

=cut

use strict ;

use Carp ;
use File::Spec ;
use Test ;
use VCP::TestUtils ;

my @vcp = vcp_cmd ;


my $t = -d 't' ? 't/' : '' ;

my @tests = (
##
## Empty imports, used here just to see if commad line parsing is ok and
## that a really simple file can make it through the XML parser ok.
##
sub {
   run [ @vcp, qw( - identity: - ) ], \"<revml/>" ;
   ok $?, 0, "`vcp revml:- identiry: revml:` return value"  ;
},

sub {
   run [ @vcp, qw( - identity: - ) ], \"<revml/>" ;
   ok $?, 0, "`vcp revml:- identiry: revml:` return value"  ;
},

sub {
  eval {
     my $out ;
     my $infile  = $t . "test-revml-in-0-no-big-files.revml" ;
     ## $in and $out allow us to avoide execing diff most of the time.
     run [ @vcp, $infile, qw( sort: -- identity: - ) ],
        \undef, \$out;

     my $in = slurp( $infile ) ;
     assert_eq $infile, $in, $out ;
  } ;
  ok $@ || '', '', 'diff' ;
},

sub {
  eval {
     my $out ;
     my $infile  = $t . "test-revml-in-0-no-big-files.revml" ;
     ## $in and $out allow us to avoide execing diff most of the time.
     run [ @vcp, $infile, qw( sort: -- identity: identity: - )],
        \undef, \$out;

     my $in = slurp( $infile ) ;
     assert_eq $infile, $in, $out ;
  } ;
  ok $@ || '', '', 'diff' ;
},
) ;

plan tests => scalar( @tests ) ;

$_->() for @tests ;