1use Test2::V0; 2 3use File::Temp qw/tempdir/; 4use File::Spec; 5 6use App::Yath::Util qw/find_yath/; 7find_yath(); # cache result before we chdir 8 9use App::Yath::Tester qw/yath/; 10use Test2::Harness::Util::File::JSONL; 11 12use Test2::Harness::Util::JSON qw/decode_json/; 13 14my $dir = __FILE__; 15$dir =~ s{\.t$}{}g; 16$dir =~ s{^\./}{}; 17 18my $out; 19 20yath( 21 command => 'projects', 22 args => ['--ext=tx', '--', $dir], 23 exit => 0, 24 test => sub { 25 my $out = shift; 26 27 like($out->{output}, qr{PASSED .*foo.*t.*pass\.tx}, "Found pass.tx in foo project"); 28 like($out->{output}, qr{PASSED .*bar.*t.*pass\.tx}, "Found pass.tx in bar project"); 29 like($out->{output}, qr{PASSED .*baz.*t.*pass\.tx}, "Found pass.tx in baz project"); 30 unlike($out->{output}, qr{fail\.txx}, "Did not run fail.txx"); 31 }, 32); 33 34yath( 35 command => 'projects', 36 args => ['--ext=tx', '--ext=txx', '--', $dir], 37 exit => T(), 38 test => sub { 39 my $out = shift; 40 like($out->{output}, qr{PASSED .*foo.*t.*pass\.tx}, "Found pass.tx in foo project"); 41 like($out->{output}, qr{PASSED .*bar.*t.*pass\.tx}, "Found pass.tx in bar project"); 42 like($out->{output}, qr{PASSED .*baz.*t.*pass\.tx}, "Found pass.tx in baz project"); 43 like($out->{output}, qr{FAILED .*baz.*t.*fail\.txx}, "ran fail.txx"); 44 }, 45); 46 47chdir($dir); 48 49yath( 50 command => 'projects', 51 args => ['--ext=tx', '-v'], 52 exit => 0, 53 test => sub { 54 my $out = shift; 55 56 like($out->{output}, qr{PASSED .*foo.*t.*pass\.tx}, "Found pass.tx in foo project"); 57 like($out->{output}, qr{PASSED .*bar.*t.*pass\.tx}, "Found pass.tx in bar project"); 58 like($out->{output}, qr{PASSED .*baz.*t.*pass\.tx}, "Found pass.tx in baz project"); 59 unlike($out->{output}, qr{fail\.txx}, "Did not run fail.txx"); 60 }, 61); 62 63yath( 64 command => 'projects', 65 args => ['--ext=tx', '--ext=txx'], 66 exit => T(), 67 test => sub { 68 my $out = shift; 69 70 like($out->{output}, qr{PASSED .*foo.*t.*pass\.tx}, "Found pass.tx in foo project"); 71 like($out->{output}, qr{PASSED .*bar.*t.*pass\.tx}, "Found pass.tx in bar project"); 72 like($out->{output}, qr{PASSED .*baz.*t.*pass\.tx}, "Found pass.tx in baz project"); 73 like($out->{output}, qr{FAILED .*baz.*t.*fail\.txx}, "ran fail.txx"); 74 }, 75); 76 77done_testing; 78