10compile_dtd.t #2

  • //
  • guest/
  • perforce_software/
  • revml/
  • t/
  • 10compile_dtd.t
  • View
  • Commits
  • Open Download .zip Download (1 KB)
#!/usr/local/bin/perl -w

=head1 NAME

10compile_dtd.t - testing of compile_dtd command

=cut

use strict ;

use Carp ;
use Test ;
use IPC::Run3 ;
use VCP::TestUtils qw( compile_dtd_cmd );

my @compile_dtd = compile_dtd_cmd ;

# Note the spaces instead of tabs and the spaces after the null:
my $null_transfer = <<'END_TRANSFER';
Source:
        null:   

Destination:    null:  
END_TRANSFER

# Note the spaces instead of tabs and the spaces after the null:
my $identity_transfer = <<'END_TRANSFER';
Source:
        null:   

Destination:    null:  

Identity:
END_TRANSFER



# run compile_dtd command line with given parameters
sub compile_dtd {
   my $exp_results = shift ;
   my $out ;
   my $err ;
   my $pid = IPC::Run3::run3 [ @compile_dtd, @_ ], \undef, \$out, \$err ;
   confess "compile_dtd ", join( ' ', @_ ), " returned $?\n$out$err"
      if defined $exp_results && ! grep $? == $_ << 8, @$exp_results ;
   return $err . $out ;
}


sub test_helper {
   my ( $cli_params, $stdin ) = @_;
   my $ok = eval {
       VCP::TestUtils::run [ @compile_dtd, @$cli_params ], $stdin ? ( "<", \$stdin ) : ();
       1;
   };
   @_ = (
      $ok || $@,
      1,
      join " ",
         "compile_dtd",
         @$cli_params,
         $stdin
            ? ( "<", qq{\\"$stdin"} )
            : ()
   );
   goto &ok;
}


my @tests = (
sub { ok compile_dtd( [ 0 ], "revml.dtd", "-" ) },
) ;

plan tests => scalar( @tests ) ;

$_->() for @tests ;
# Change User Description Committed
#4 3425 Barrie Slaymaker - Test suite cleanup
#3 2754 John Fetkovich Convert to use IPC::Run3::run3 rather than IPC::Run::run
#2 2748 John Fetkovich Change to use IPC::Run3 rather than IPC::Run
#1 2454 John Fetkovich Compile_dtd compiles and saves a revml .dtd as a perl module.
       factored out of vcp command.