subdir_unhappy.t (898B)
1 # 2 # SUBDIR Unhappy paths. 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 # 13 # 1) SUBDIR does not exist 14 # 15 my $o = "===> dir_not_exist\n"; 16 my $e = 'make: chdir\(.*/dir_not_exist\): No such file or directory'; 17 18 $cmd->write( 'Makefile', <<EOF ); 19 SRCS = 20 SUBDIR = dir_not_exist 21 22 .include "$html_mk" 23 EOF 24 25 $cmd->run( chdir => $cmd->curdir ); 26 27 is( $cmd->stdout, $o, 'make stdout' ); 28 like( $cmd->stderr, qr{$e}, 'make stderr' ); 29 is( $? >> 8, 2, 'make exit status' ); 30 31 # 32 # 2) SUBDIR is a file. 33 # 34 $o = "===> dir_not_exist\n"; 35 $e = 'make: chdir\(.*/dir_not_exist\): Not a directory'; 36 37 $cmd->write( 'dir_not_exist', '' ); 38 39 $cmd->run( chdir => $cmd->curdir ); 40 41 is( $cmd->stdout, $o, 'make stdout' ); 42 like( $cmd->stderr, qr{$e}, 'make stderr' ); 43 is( $? >> 8, 2, 'make exit status' );