html.mk

static html creation framework using make(1) and cpp(1)
git clone git://0x30.net/html.mk
Log | Files | Refs | README | LICENSE

srcs_multiple.t (1350B)


      1 #
      2 # Building multiple source files in tree and out of tree.
      3 #
      4 use Modern::Perl;
      5 use Test::Cmd;
      6 use Test::File;
      7 use Test::More tests => 13;
      8 
      9 
     10 my $cmd = Test::Cmd->new( prog => '/usr/bin/make', workdir => '' );
     11 my $html_mk = $cmd->here . "/bsd.html.mk";
     12 
     13 $cmd->write( 'Makefile', <<EOF );
     14 SRCS += a.in b.in c.in
     15 
     16 .include "$html_mk"
     17 EOF
     18 
     19 $cmd->write( 'a.in', <<EOF );
     20 <p> This is file a.  </p>
     21 EOF
     22 
     23 $cmd->write( 'b.in', <<EOF );
     24 <p> This is file a.  </p>
     25 EOF
     26 
     27 $cmd->write( 'c.in', <<EOF );
     28 <p> This is file a.  </p>
     29 EOF
     30 
     31 #
     32 # 1) First check that output files are created in tree.
     33 #
     34 
     35 $cmd->run( chdir => $cmd->curdir );
     36 
     37 like( $cmd->stdout,	qr/.*/,	'make stdout' );
     38 is( $cmd->stderr,	"",	'make stderr' );
     39 is( $? >> 8,		0,	'make exit status' );
     40 
     41 file_exists_ok( $cmd->workdir . '/a.html' );
     42 file_exists_ok( $cmd->workdir . '/b.html' );
     43 file_exists_ok( $cmd->workdir . '/c.html' );
     44 
     45 #
     46 # 2) Now run `make obj` and make sure files are created in obj/.
     47 #
     48 
     49 $cmd->run( args => 'obj', chdir => $cmd->curdir );
     50 is( $? >> 8,		0,	'make obj exit status' );
     51 
     52 $cmd->run( chdir => $cmd->curdir );
     53 
     54 like( $cmd->stdout,	qr/.*/,	'make stdout' );
     55 is( $cmd->stderr,	"",	'make stderr' );
     56 is( $? >> 8,		0,	'make exit status' );
     57 
     58 file_exists_ok( $cmd->workdir . '/obj/a.html' );
     59 file_exists_ok( $cmd->workdir . '/obj/b.html' );
     60 file_exists_ok( $cmd->workdir . '/obj/c.html' );