Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A failing subtest within a subtest within a TODO will emit the failures on prove #684

Closed
petdance opened this issue Jun 22, 2016 · 4 comments

Comments

@petdance
Copy link
Contributor

Originally submitted to https://rt.cpan.org/Ticket/Display.html?id=115522 and I was referred over here.

A failing subtest within a subtest within a TODO will emit the failures on prove. I would expect all the diagnostics for the failures to be hidden, but the nested ones make their way out to the user. The test passes overall, but has messy diagnostics that we don't want to see. The horse/sheep mismatch is suppressed correctly, but the cow/pig mismatch goes to the screen.

$ cat foo.t
use warnings;
use strict;
use Test::More 'no_plan';

diag "Perl $], Test::More $Test::More::VERSION\n";
TODO: {
    local $TODO = 'Have not changed laws of biology';

    subtest 'Farm animals' => sub {
        is( 'horse', 'sheep', 'Horses and sheep are the same' );

        subtest 'Barn animals' => sub {
            is( 'cow', 'pig', 'Cows and pigs are the same' );
        };

        is( 'duck', 'goose', 'Duck and goose are the same' );
    };
}


$ prove foo.t
[16:04:05] foo.t .. # Perl 5.020003, Test::More 1.302015


        #   Failed test 'Cows and pigs are the same'
        #   at foo.t line 13.
        #          got: 'cow'
        #     expected: 'pig'
        # Looks like you failed 1 test of 1.


[16:04:05] foo.t .. ok       63 ms ( 0.00 usr  0.00 sys +  0.06 cusr  0.00 csys =  0.06 CPU)
[16:04:05]
All tests successful.
Files=1, Tests=1,  0 wallclock secs ( 0.03 usr  0.00 sys +  0.06 cusr  0.00 csys =  0.09 CPU)
Result: PASS


$ prove --version
TAP::Harness v3.36 and Perl v5.20.3
@petdance
Copy link
Contributor Author

I tested this on an old version of Test::More and it passes just fine.

$ prove --version
TAP::Harness v3.29 and Perl v5.10.1

$ prove foo.t
[21:11:26] foo.t .. # Perl 5.010001, Test::More 1.001002
[21:11:26] foo.t .. ok       33 ms
[21:11:26]
All tests successful.
Files=1, Tests=1,  0 wallclock secs ( 0.02 usr  0.00 sys +  0.01 cusr  0.00 csys =  0.03 CPU)
Result: PASS

@exodist
Copy link
Member

exodist commented Jun 22, 2016

I have a fix for this, but not a good test (yet) once I write the test I will get the fix out.

@exodist
Copy link
Member

exodist commented Jun 22, 2016

this was caused by a different recent bugfix.

exodist added a commit that referenced this issue Jun 22, 2016
    - Fix nested TODO handling of Diags (#684)
@exodist
Copy link
Member

exodist commented Jun 25, 2016

fixed

@exodist exodist closed this as completed Jun 25, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants