| 1 |
use Test2::V0; |
| 2 |
|
| 3 |
use File::Temp qw/tempdir/; |
| 4 |
use File::Spec; |
| 5 |
|
| 6 |
use App::Yath::Tester qw/yath/; |
| 7 |
use Test2::Harness::Util::File::JSONL; |
| 8 |
|
| 9 |
use Test2::Harness::Util::JSON qw/decode_json/; |
| 10 |
|
| 11 |
my $dir = __FILE__; |
| 12 |
$dir =~ s{\.t$}{}g; |
| 13 |
$dir =~ s{^\./}{}; |
| 14 |
|
| 15 |
yath( |
| 16 |
command => 'test', |
| 17 |
args => [$dir, '--ext=tx'], |
| 18 |
log => 1, |
| 19 |
exit => T(), |
| 20 |
test => sub { |
| 21 |
my $out = shift; |
| 22 |
my $logfile = $out->{log}->name; |
| 23 |
|
| 24 |
$out = yath( |
| 25 |
command => 'failed', |
| 26 |
args => [$logfile], |
| 27 |
env => {TABLE_TERM_SIZE => 1000, TS_TERM_SIZE => 1000}, |
| 28 |
exit => 0, |
| 29 |
test => sub { |
| 30 |
my $out = shift; |
| 31 |
|
| 32 |
ok(!$out->{exit}, "'failed' command exits true"); |
| 33 |
like($out->{output}, qr{fail\.tx}, "'fail.tx' was seen as a failure when reading the log"); |
| 34 |
unlike($out->{output}, qr{pass\.tx}, "'pass.tx' was not seen as a failure when reading the log"); |
| 35 |
}, |
| 36 |
); |
| 37 |
|
| 38 |
# GH #300: 'yath failed --interactive' should not crash with |
| 39 |
# "The 'quiet' field does not exist" |
| 40 |
$out = yath( |
| 41 |
command => 'failed', |
| 42 |
args => ['-i', $logfile], |
| 43 |
exit => 0, |
| 44 |
test => sub { |
| 45 |
my $out = shift; |
| 46 |
|
| 47 |
ok(!$out->{exit}, "'failed -i' command exits true"); |
| 48 |
unlike($out->{output}, qr{field does not exist}, "'failed -i' does not crash on missing display fields"); |
| 49 |
}, |
| 50 |
); |
| 51 |
}, |
| 52 |
); |
| 53 |
|
| 54 |
|
| 55 |
|
| 56 |
done_testing; |