Skip to content

Commit

Permalink
bring in tests from t/24data.t
Browse files Browse the repository at this point in the history
  • Loading branch information
book committed Mar 31, 2012
1 parent d41adc1 commit 4c1981a
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 29 deletions.
31 changes: 31 additions & 0 deletions lib/Test/MetaSyntactic.pm
Expand Up @@ -30,6 +30,7 @@ sub theme_ok {
$tb->subtest( "format $theme", sub { subtest_format(@args); } );
$tb->subtest( "uniq $theme", sub { subtest_uniq(@args); } );
$tb->subtest( "length $theme", sub { subtest_length(@args); } );
$tb->subtest( "data $theme", sub { subtest_data(@args); } );
$tb->done_testing;
}

Expand Down Expand Up @@ -140,6 +141,36 @@ sub subtest_length {
}
}

# t/24data.t
sub subtest_data {
my ( $theme, $file ) = @_;
my $tb = __PACKAGE__->builder;
$tb->plan( tests => 1 );

SKIP: {
if ( !$file ) {
$tb->skip( "This test needs the source file for $theme", 1 );
last SKIP;
}
open my $fh, $file or do {
$tb->skip( "Can't open $file: $!", 1 );
last SKIP;
};

my ( $fail, $in_data ) = ( 0, 0 );
my @lines;
while (<$fh>) {
$in_data++ if /^__DATA__$/;
next if !$in_data;
$fail++, push @lines, $.
if /^#/ && !/^# ?(?:names(?: +[-\w]+)*|default)\s*$/;
}
$tb->is_eq( $fail, 0, "__DATA__ section for $file" );
$tb->diag("Failed lines: @lines") if @lines;
close $fh;
}
}

1;

__END__
Expand Down
29 changes: 0 additions & 29 deletions t/24data.t

This file was deleted.

0 comments on commit 4c1981a

Please sign in to comment.