Skip to content

Commit

Permalink
Test additional branches and conditions in
Browse files Browse the repository at this point in the history
Parrot::Headerizer::Functions::qualify_sourcefile().
  • Loading branch information
jkeenan committed Nov 21, 2010
1 parent eabb0e8 commit a8c428d
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
20 changes: 19 additions & 1 deletion t/tools/dev/headerizer/01_functions.t
Expand Up @@ -126,7 +126,6 @@ like($@, qr/$ofile doesn't look like an object file/,
"Got expected die message for file lacking HEADERIZER HFILE directive" );
}

#t/tools/dev/headerizer/testlib/none.in
{
my $tdir = tempdir( CLEANUP => 1 );
my $stub = 'none';
Expand All @@ -146,6 +145,25 @@ like($@, qr/$ofile doesn't look like an object file/,
is( $hfile, 'none', "As expected, no header file" );
}

{
my $tdir = tempdir( CLEANUP => 1 );
my $stub = 'missingheaderfile';
copy "$cwd/t/tools/dev/headerizer/testlib/$stub.in" =>
"$tdir/$stub.c" or croak "Unable to copy file for testing";
$ofile = "$tdir/$stub.o";
my $expected_cfile = "$tdir/$stub.c";
eval {
my ($sourcefile, $source_code, $hfile) =
qualify_sourcefile( {
ofile => $ofile,
PConfig => \%PConfig,
is_yacc => 0,
} );
};
like($@, qr/"$stub" not found \(referenced from "$expected_cfile"\)/,
"Got expected error message for missing header file" );
}

pass("Completed all tests in $0");

#sub touch_parrot {
Expand Down
2 changes: 2 additions & 0 deletions t/tools/dev/headerizer/testlib/missingheaderfile.in
@@ -0,0 +1,2 @@
This file has a valid HEADERIZER HFILE directive but no corresponding header file.
/* HEADERIZER HFILE: missingheaderfile */

0 comments on commit a8c428d

Please sign in to comment.