html.mk

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

include_subdir.t (1140B)


      1 #
      2 # Create a one directory site in tree with common include dir.
      3 #
      4 use Modern::Perl;
      5 use Test::Cmd;
      6 use Test::More tests => 6;
      7 
      8 
      9 my $cmd = Test::Cmd->new( prog => '/usr/bin/make', workdir => '' );
     10 my $html_mk = $cmd->here . "/bsd.html.mk";
     11 
     12 $cmd->subdir( 'include', 'dir', );
     13 
     14 # Makefile
     15 $cmd->write( 'Makefile', <<EOF );
     16 SUBDIR += dir
     17 CPPFLAGS= -Iinclude
     18 
     19 .include "$html_mk"
     20 EOF
     21 
     22 # index.in
     23 $cmd->write( 'index.in', <<EOF );
     24 #include "head.html"
     25 this is the root file
     26 EOF
     27 
     28 # include/head.html
     29 $cmd->write( [ 'include', 'head.html' ], 'this is the head file' );
     30 
     31 # dir/index.in
     32 $cmd->write( ['dir', 'index.in' ], <<EOF );
     33 #include "head.html"
     34 'this is the dir file'
     35 EOF
     36 
     37 # dir/Makefile
     38 $cmd->write( ['dir', 'Makefile' ], <<EOF );
     39 CPPFLAGS= -I../include
     40 
     41 .include "$html_mk"
     42 EOF
     43 
     44 $cmd->run( args => "depend", chdir => $cmd->curdir );
     45 
     46 like( $cmd->stdout,	qr{.*},	'make depend stdout' );
     47 is( $cmd->stderr,	"",	'make depend stderr' );
     48 is( $? >> 8,		0,	'make depend exit status' );
     49 
     50 $cmd->run( chdir => $cmd->curdir );
     51 
     52 like( $cmd->stdout,	qr{.*},	'make stdout' );
     53 is( $cmd->stderr,	"",	'make stderr' );
     54 is( $? >> 8,		0,	'make exit status' );