in reply to Keeping SKIP Test Blocks Under Control

Why are you nesting your SKIP blocks? (I know, "because merlyn did it" -- that alone is insufficient reason) It appears that if a skip happens, you just skip all the way to the end. The only thing SKIP blocks are used for is Test::More's skip function, which just does some accounting and then last SKIP.

The code you posted is equivalent to this code:

# $mech is a previously-intitlized WWW::Mechanize # instance currently holding the page I want to test SKIP: { ok( $mech->response->is_success, "Request is successful" ) or skip "Unsuccessful request", 4; # ignoring repeated is_html test in original post ok( $mech->is_html, "Returns HTML" ) or skip "Didn't return HTML", 3; ok( $mech->title eq 'some title', "Returns expected title" ); my @forms = $mech->forms; ok( @forms >= 1, "Has at least one form" ) or skip "Need at least one form to work on", 1; my ($passwd_form) = @forms; ok( $passwd_form->action eq 'example.cgi', "action goes to correct CGI" ); }

Replies are listed 'Best First'.
•Re: Re: Keeping SKIP Test Blocks Under Control
by merlyn (Sage) on Apr 12, 2004 at 17:37 UTC
      It's ok. You're allowed to be human.
Re: Re: Keeping SKIP Test Blocks Under Control
by hardburn (Abbot) on Apr 12, 2004 at 17:39 UTC

    Why are you nesting your SKIP blocks?

    Because I wasn't sure if repeated skip statements would work and I couldn't find any examples of implementing it without nested blocks. Though now that I think about the implementation details of Test::More::skip, this probably should have been obvious.

    # ignoring repeated is_html test in original post

    Oops. I was cleaning up and sanitizing the code that I'm actually developing for a project, and that one sliped through.

    ----
    : () { :|:& };:

    Note: All code is untested, unless otherwise stated