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_suffix.t (1586B)


      1 #
      2 # No and strange file suffixes in SRCS array.
      3 # These are different cases because make behaviour is dependent on suffixes.
      4 #
      5 use Modern::Perl;
      6 use Test::Cmd;
      7 use Test::More tests => 12;
      8 
      9 my $cmd = Test::Cmd->new( prog => '/usr/bin/make', workdir => '' );
     10 my $html_mk = $cmd->here . "/bsd.html.mk";
     11 
     12 #
     13 # 1) File with no suffix in SRCS array and does not exist errors
     14 #
     15 $cmd->write( 'Makefile', <<EOF );
     16 SRCS = no_file_suffix
     17 
     18 .include "$html_mk"
     19 EOF
     20 
     21 # This is an ok error message.
     22 my $e = "make: don't know how to make no_file_suffix";
     23 
     24 $cmd->run( chdir => $cmd->curdir );
     25 is( $cmd->stdout, 	'',	'make stdout' );
     26 like( $cmd->stderr,	qr{$e},	'make stderr' );
     27 is( $? >> 8,		2,	'make exit status' );
     28 
     29 #
     30 # 1a) File with no suffix in SRCS array but file exists shows no error.
     31 #
     32 $cmd->write( 'no_file_suffix', '' );
     33 
     34 $cmd->run( chdir => $cmd->curdir );
     35 is( $cmd->stdout, 	'',	'make stdout' );
     36 is( $cmd->stderr,	'',	'make stderr' );
     37 is( $? >> 8,		0,	'make exit status' );
     38 
     39 
     40 #
     41 # 2) File with bad suffix in SRCS array that does not exist errors.
     42 #
     43 $cmd->write( 'Makefile', <<EOF );
     44 SRCS = bad.sfx
     45 
     46 .include "$html_mk"
     47 EOF
     48 
     49 $e = "make: don't know how to make bad.sfx";
     50 
     51 $cmd->run( chdir => $cmd->curdir );
     52 is( $cmd->stdout, 	'',	'make stdout' );
     53 like( $cmd->stderr,	qr{$e},	'make stderr' );
     54 is( $? >> 8,		2,	'make exit status' );
     55 
     56 #
     57 # 2b) File with bad suffix in SRCS array but file exists shows no error.
     58 #
     59 $cmd->write( 'bad.sfx', '' );
     60 
     61 $cmd->run( chdir => $cmd->curdir );
     62 is( $cmd->stdout, 	'',	'make stdout' );
     63 is( $cmd->stderr,	'',	'make stderr' );
     64 is( $? >> 8,		0,	'make exit status' );