App-xml_grep2

 view release on metacpan or  search on metacpan

t/01-options.t  view on Meta::CPAN

use warnings;

use utf8;
use XML::LibXML;

binmode STDOUT, ':utf8';
binmode STDERR, ':utf8';

use Test::More tests => 90;

sub is_fuzzy($$$);

my $PERL= $^X;
my $OS  = $^O;
my $WIN = $OS =~ m{^MSWin} ? 1 : 0;

my $XML_GREP2 = "$PERL bin/xml_grep2";
my $TEST_DIR  = "t";
my $TEST_FILE = "test.xml";
my $DATA      = "$TEST_DIR/$TEST_FILE";
my $HTML      = "$TEST_DIR/test.html";

t/01-options.t  view on Meta::CPAN

    $file ||= $DATA; 
    return qq{<xg2:file xg2:filename="$file">$to_wrap</xg2:file>};
  }

sub trace
  { my $command= join( ' ', @_);
    if( grep /-v/, $ARGV[0]) { warn "$command\n"; }
    return `$command`;
  }

sub is_fuzzy($$$)
  { my( $got, $expected, $message)= @_;
    (my $stripped_expected= $expected)=~ s{\s}{}g;
    (my $stripped_got= $got)=~ s{\s}{}g;
    if( $stripped_got eq $stripped_expected)
      { ok( 1, $message); }
    else
      { ok( 0, $message);
        warn "  got     : $got\n  expected:$expected\n";
        #warn "  got     : $stripped_got\n  expected: $stripped_expected\n";
      }



( run in 0.236 second using v1.01-cache-2.11-cpan-65fba6d93b7 )