Skip to content

Commit

Permalink
Actually parse version and add a test
Browse files Browse the repository at this point in the history
  • Loading branch information
leto committed May 6, 2011
1 parent 2cdd5cd commit 34e3c86
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/m0/m0_assembler.pl
Expand Up @@ -34,7 +34,8 @@ sub assemble {
my $source = slurp($file);
$source = remove_junk($source);

#my $version = parse_version($source);
my $version = parse_version($source);
say "Parsing M0 v$version";

parse_next_chunk($source);
}
Expand Down
8 changes: 7 additions & 1 deletion t/m0/m0_assembler.t
Expand Up @@ -21,7 +21,7 @@ use warnings;
use Test::More;
use File::Spec::Functions;

plan tests => 3;
plan tests => 4;

my $exefile = catfile( ".", qw/src m0 m0_assembler.pl/ );

Expand All @@ -31,6 +31,12 @@ output_like(
'parse hello.m0'
);

output_like(
catfile(qw/t m0 hello.m0/),
qr/Parsing M0 v0/,
'detect M0 v0'
);

output_like(
catfile(qw/t m0 hello_invalid.m0/),
qr/Invalid M0/ms,
Expand Down

0 comments on commit 34e3c86

Please sign in to comment.