Skip to content

Commit

Permalink
Moved use statments around
Browse files Browse the repository at this point in the history
  • Loading branch information
trcjr committed May 17, 2011
1 parent ad48f24 commit 0311dea
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 19 deletions.
6 changes: 4 additions & 2 deletions lib/Parse/Selenese/Command.pm
@@ -1,11 +1,13 @@
# ABSTRACT: A Selenese Command
package Parse::Selenese::Command;
use strict;
use warnings;
use Moose;
use Parse::Selenese::TestCase;
use Carp ();
use HTML::TreeBuilder;
use Template;

package Parse::Selenese::Command;
use Moose;

has 'values' =>
( isa => 'ArrayRef', is => 'rw', required => 0, default => sub { [] } );
Expand Down
33 changes: 16 additions & 17 deletions lib/Parse/Selenese/TestSuite.pm
@@ -1,15 +1,15 @@
# ABSTRACT: A Selenese Test Case
package Parse::Selenese::TestSuite;
use strict;
use warnings;
use Moose;
use Carp ();
use File::Basename;
use HTML::TreeBuilder;
use Parse::Selenese::TestCase;

package Parse::Selenese::TestSuite;
use Moose;
extends'Parse::Selenese::Base';

has ' cases ' =>
( isa => ' ArrayRef ', is => ' rw ', required => 0, default => sub { [] } );
has 'cases' =>
( isa => 'ArrayRef', is => 'rw', required => 0, default => sub { [] } );

# Return whether the specified file is a test suite or not
# static method
Expand All @@ -21,17 +21,17 @@ sub is_suite_file {
my $tree = HTML::TreeBuilder->new;
$tree->parse_file($filename);

my $table = $tree->look_down('id', 'suiteTable');
return !! $table;
my $table = $tree->look_down( 'id', 'suiteTable' );
return !!$table;
}

# Bulk convert test cases in this suite
sub bulk_convert {
my $self = shift;

my @outfiles;
foreach my $case (@{ $self->cases }) {
push(@outfiles, $case->convert_to_perl);
foreach my $case ( @{ $self->cases } ) {
push( @outfiles, $case->convert_to_perl );
}
return @outfiles;
}
Expand All @@ -47,7 +47,7 @@ sub get_case_files {
}

sub new_o {
my ($class, $filename) = @_;
my ( $class, $filename ) = @_;
my $self = bless {
filename => $filename,
cases => undef,
Expand All @@ -59,7 +59,7 @@ sub new_o {
}

sub parse {
my $self = shift;
my $self = shift;
my $suite_filename = $self->{filename};

die " Can't read $suite_filename " unless -r $suite_filename;
Expand All @@ -76,7 +76,7 @@ sub parse {
}

# <tbody>以下からコマンドを抽出
my $tbody = $tree->find('tbody');
my $tbody = $tree->find('tbody');
my $base_dir = File::Basename::dirname( $self->{filename} );
my @cases;
if ($tbody) {
Expand All @@ -86,15 +86,14 @@ sub parse {
my $case;
eval {
$case = Parse::Selenese::TestCase->new(
$base_dir . '/' . $link->attr('href')
);
$base_dir . '/' . $link->attr('href') );
};
if ($@) {
warn " Can't read test case $base_dir /
".$link->attr('href')."
" . $link->attr('href') . "
: $! \n ";
}
push(@cases, $case) if $case;
push( @cases, $case ) if $case;
}
}
}
Expand Down

0 comments on commit 0311dea

Please sign in to comment.