| 1 |
use Test2::V0; |
| 2 |
|
| 3 |
use File::Temp qw/tempdir/; |
| 4 |
use File::Spec; |
| 5 |
use File::Copy qw/copy/; |
| 6 |
|
| 7 |
use Test2::Harness::Util::File::JSONL; |
| 8 |
|
| 9 |
use App::Yath::Tester qw/yath/; |
| 10 |
|
| 11 |
use App::Yath::Util qw/find_yath/; |
| 12 |
find_yath(); # cache result before we chdir |
| 13 |
|
| 14 |
my $tmp = tempdir(CLEANUP => 1); |
| 15 |
|
| 16 |
my $dir = __FILE__; |
| 17 |
$dir =~ s{\.t$}{}g; |
| 18 |
$dir =~ s{^\./}{}; |
| 19 |
|
| 20 |
my $pass = File::Spec->catfile($tmp, 'pass.tx'); |
| 21 |
my $pass2 = File::Spec->catfile($tmp, 'pass2.tx'); |
| 22 |
|
| 23 |
copy(File::Spec->catfile($dir, 'pass.tx'), $pass); |
| 24 |
copy(File::Spec->catfile($dir, 'pass2.tx'), $pass2); |
| 25 |
|
| 26 |
my $out = yath(command => 'test', args => [$tmp, '--ext=tx'], log => 1, exit => 0); |
| 27 |
my $log = $out->{log}->name; |
| 28 |
|
| 29 |
yath( |
| 30 |
command => 'speedtag', |
| 31 |
args => [$log], |
| 32 |
exit => 0, |
| 33 |
test => sub { |
| 34 |
like($_, qr/Tagged .*pass\.tx/, "Indicate we tagged pass"); |
| 35 |
like($_, qr/Tagged .*pass2\.tx/, "Indicate we tagged pass2"); |
| 36 |
|
| 37 |
for my $file ($pass, $pass2) { |
| 38 |
open(my $fh, '<', $file) or die $!; |
| 39 |
my $found = 0; |
| 40 |
while (my $line = <$fh>) { |
| 41 |
chomp($line); |
| 42 |
next unless $line =~ m/^#\s*HARNESS-DURATION-(SHORT|MEDIUM|LONG)$/; |
| 43 |
$found = 1; |
| 44 |
last; |
| 45 |
} |
| 46 |
$file =~ s/^.*(pass\d?\.tx)$/$1/; |
| 47 |
ok($found, "Tagged file $file"); |
| 48 |
} |
| 49 |
}, |
| 50 |
); |
| 51 |
|
| 52 |
done_testing; |