From cc5d96a3fffedfe4a84a174c1f14a779ce6504e8 Mon Sep 17 00:00:00 2001 From: Gabor Szabo Date: Tue, 23 Feb 2021 10:23:29 +0200 Subject: [PATCH] test case for #38 added on a branch --- t/81-examples.t | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 t/81-examples.t diff --git a/t/81-examples.t b/t/81-examples.t new file mode 100644 index 0000000..4257682 --- /dev/null +++ b/t/81-examples.t @@ -0,0 +1,26 @@ +use strict; +use warnings; + +use Test::More tests => 5; +use Capture::Tiny qw(capture); +plan( skip_all => "This test fails on Perl 5.12 and earlier probably because of lack of subtest support." ) if $] < 5.014; + +diag "good_test_count_and_exception"; +{ + my ($out, $err, $exit) = capture { system "$^X t/examples/good-test-count-and-exception.pl" }; + is $exit, 256; + cmp_ok index($out, 'not ok 3 - mytest died'), '>', 0; + cmp_ok index($out, '123123'), '>', 0; + cmp_ok index($err, 'mytest died'), '>', 0; +} + +diag "bad_test_count_and_exception"; +{ + my ($out, $err, $exit) = capture { system "$^X t/examples/bad-test-count-and-exception.pl" }; + #is $exit, 256; + #cmp_ok index($out, 'not ok 3 - mytest died'), '>', 0; + #cmp_ok index($out, '123123'), '>', 0; + #cmp_ok index($err, 'mytest died'), '>', 0; + ok 1; +} +