Debian Codegraph @

t/integration/init.t

raw
1 use Test2::V0;
2
3 use File::Temp qw/tempdir/;
4 use File::Spec;
5 use Cwd qw/cwd/;
6
7 use App::Yath::Tester qw/yath/;
8 use App::Yath::Util qw/find_yath/;
9 find_yath(); # cache result before we chdir
10
11 my $orig = cwd();
12 my $dir = tempdir(CLEANUP => 1);
13 chdir($dir);
14
15 yath(
16 command => 'init',
17 args => [],
18 exit => 0,
19 test => sub {
20 like($_, qr/Writing test\.pl/, "Short message");
21
22 ok(-e 'test.pl', "Added test.pl");
23
24 open(my $fh, '<', 'test.pl') or die $!;
25 my $found = 0;
26 while (my $line = <$fh>) {
27 next unless $line =~ m/THIS IS A GENERATED YATH RUNNER TEST/;
28 $found++;
29 last;
30 }
31
32 ok($found, "Found generated note");
33 },
34 );
35
36 chdir($orig);
37
38 done_testing;