Skip to content

Commit

Permalink
Passing tests again
Browse files Browse the repository at this point in the history
  • Loading branch information
trcjr committed Sep 5, 2011
1 parent 4539f45 commit 34561c6
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 20 deletions.
7 changes: 2 additions & 5 deletions lib/Parse/Selenese/Command.pm
Expand Up @@ -392,16 +392,13 @@ EOF

sub make_args {
my ( $code, @args ) = @_;

my $str = '';
if ( $code->{force_args} ) {
$str .= join( ', ', map { quote($_) } @{ $code->{force_args} } );
}
else {
@args =
#map { $args[$_] // '' } ( 0 .. $code->{args} - 1 );
map { s/^exact:// } @args;

my @args = map { $args[$_] // '' } ( 0 .. $code->{args} - 1 );
map { s/^exact:// } @args;
if ( defined $code->{func} && $code->{func} eq '#' ? 0 : 1 ) {
$str .= join( ', ', map { quote($_) } @args );
}
Expand Down
8 changes: 6 additions & 2 deletions lib/Parse/Selenese/TestCase.pm
Expand Up @@ -179,8 +179,12 @@ sub parse {
die "Um, I can't read the file you gave me to parse!";
}
$self->_tree->parse_file( $self->filename );
} else {
$self->_tree->parse($self->content);
}
elsif ( $self->has_content ) {
$self->_tree->parse( $self->content );
}
else {
die "Must specifiy either content or filename";
}

foreach my $link ( $self->_tree->find('link') ) {
Expand Down
21 changes: 8 additions & 13 deletions t/lib/Parse/Selenese/TestCase/Test.pm
Expand Up @@ -87,8 +87,7 @@ sub test_each_stored_selenese_file : Tests {

foreach my $test_selenese_file ( @{ $self->selenese_data_files } ) {
$test_selenese_file = File::Spec->abs2rel($test_selenese_file);
my ( $file, $dir, $ext ) =
File::Basename::fileparse( $test_selenese_file, qr/\.[^.]*/ );
my ( $file, $dir, $ext ) = File::Basename::fileparse( $test_selenese_file, qr/\.[^.]*/ );
my $yaml_data_file = "$dir$file.yaml";

# Parse the html file
Expand Down Expand Up @@ -129,8 +128,9 @@ sub test_save_file : Tests {

# Change the filename of the new case to match that of our control
$new_case->filename( $c->filename );
is_deeply( $c, $new_case,
"Parsing saved case gives an equilivent to the original case" );

is_deeply( $new_case->as_html, $c->as_html, "Parsing saved case gives an equilivent to the original case Selenese" );
is_deeply( $new_case->as_perl, $c->as_perl, "Parsing saved case gives an equilivent to the original case Perl" );
lives_ok {
$new_case->save($fname);
}
Expand Down Expand Up @@ -160,15 +160,11 @@ sub _test_selenese {
my $content = join( '', <$io> );
close $io;
my $case2 = Parse::Selenese::TestCase->new( content => $content );

my $case3 =
Parse::Selenese::TestCase->new( filename => $test_selenese_file );
my $case3 = Parse::Selenese::TestCase->new( filename => $test_selenese_file );
$case3->parse;

eq_or_diff $content, $case->as_html,
$case->filename . ' - selenese output precisely';
eq_or_diff $case->as_html, $case2->as_html,
$case->filename . ' - as_html reparsed still is the same';
eq_or_diff $case->as_html, $content, $case->filename . ' - selenese output precisely';
eq_or_diff $case2->as_html, $case->as_html, $case->filename . ' - as_html reparsed still is the same';
}

sub _num_tests_for_case {
Expand Down Expand Up @@ -202,8 +198,7 @@ sub _test_perl {
skip $_, $test_count;
};
unified_diff;
eq_or_diff $expected, $case->as_perl,
$case->filename . ' - selenese output precisely';
eq_or_diff $case->as_perl, $expected, $case->filename . ' - perl output precisely';
}
}

Expand Down

0 comments on commit 34561c6

Please sign in to comment.