60identity.t #4

  • //
  • guest/
  • perforce_software/
  • revml/
  • t/
  • 60identity.t
  • View
  • Commits
  • Open Download .zip Download (1 KB)
#!/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( identity: - ), "--sort-by=name,rev_id" ],
        \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( identity: identity: - ), "--sort-by=name,rev_id"],
        \undef, \$out;

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

plan tests => scalar( @tests ) ;

$_->() for @tests ;
# Change User Description Committed
#5 3115 Barrie Slaymaker Move sorting function to the new VCP::Filter::sort;
       it's for testing and reporting only and the code
       was bloating VCP::Dest and limiting VCP::Rev
       and VCP::Dest optimizations.  Breaks test suite in minor
       way.
#4 2370 John Fetkovich Modified to use vcp_cmd from VCP::TestUtils.
#3 2314 Barrie Slaymaker Build, use -no-big-files.revml for test speedups
#2 2313 Barrie Slaymaker Silence warnings
#1 2302 Barrie Slaymaker test, debug filter chain CLI parsing