Debian Codegraph @

t/integration/projects.t

raw
1 use Test2::V0;
2
3 use File::Temp qw/tempdir/;
4 use File::Spec;
5
6 use App::Yath::Util qw/find_yath/;
7 find_yath(); # cache result before we chdir
8
9 use App::Yath::Tester qw/yath/;
10 use Test2::Harness::Util::File::JSONL;
11
12 use Test2::Harness::Util::JSON qw/decode_json/;
13
14 my $dir = __FILE__;
15 $dir =~ s{\.t$}{}g;
16 $dir =~ s{^\./}{};
17
18 my $out;
19
20 yath(
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
34 yath(
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
47 chdir($dir);
48
49 yath(
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
63 yath(
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
77 done_testing;