#!/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 %seen ; my @perl = ( $^X, map { my $s = $_ ; $s = File::Spec->rel2abs( $_ ) ; "-I$s" ; } grep ! $seen{$_}++, @INC ) ; ## We always run vcp by doing a @perl, vcp, to make sure that vcp runs under ## the same version of perl that we are running under. my $vcp = 'vcp' ; $vcp = "bin/$vcp" if -e "bin/$vcp" ; $vcp = "../bin/$vcp" if -e "../bin/$vcp" ; $vcp = File::Spec->rel2abs( $vcp ) ; my @vcp = ( @perl, $vcp ) ; 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.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.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 ) ; unless ( -e $vcp ) { print STDERR "# '$vcp' not found\n" ; skip( 1, '' ) for @tests ; exit ; } $_->() 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 |