Skip to content

Checks with name overrides context name #35

@happy-barney

Description

@happy-barney

Example:

use Test::Exception;
use Test::Spec;

sub as (&) { shift; }

describe "what" => as {
    context "when" => as {
        my $obj;
        it 'should pass' => as { pass };
        it 'should pass with name' => as { pass "with name" };
        it 'should die' => as { throws_ok { $obj->build ({}) } qr/^(?=.*\bbuild\b)/ };
    };
};

runtests unless caller;

Output:

ok 1 - what when should pass
ok 2 - with name
ok 3 - threw Regexp ((?^:^(?=.*\bbuild\b)))
1..3

Expected output:

ok 1 - what when should pass
ok 2 - what when should pass with name
ok 3 - what when should die
1..3

Better output (mimics Test::More::subtest)

    # describe: what
        # context: what when
        ok 1 - what when should pass
        ok 2 - what when should pass with name
        ok 3 - what when should die
        1..3
    ok 1 - what when
    1..1
ok 1 - what
1..1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions