>>>>> "schwern" == schwern  <[EMAIL PROTECTED]> writes:

schwern> On Sat, Jul 21, 2001 at 03:47:09PM +0200,  Marc A. Lehmann  wrote:
>> It's a hack. Also it's totally unclear to me (from your description),
>> wether FOO: foo etc.. are all named the same and wether foo should
>> magically deduce the name of the label form it's name etc.. etc..

schwern> FOO is a set name, foo() is aware of it.

schwern> Here's the real problem:

schwern>        ok( 2 + 2 == 5 );               # prints "not ok 1\n"

schwern>        TODO: {
schwern>            todo("Some stuff");

schwern>            ok( some_unfinished_func(42) == 23 );  # "not ok 2 # TODO\n"
schwern>        }

schwern>        ok( "foo" eq "bar" );           # "not ok 3\n";

schwern> Basically, the ok() inside the TODO block has to *somehow* be aware
schwern> that its inside the TODO block so it can print the special "# TODO"
schwern> flag.  Whether it does this by todo() setting a flag, or ok() noticing
schwern> that it's inside a block called "TODO", doesn't matter.

schwern> I'd like to avoid XS, since this module (Test::More) has to work
schwern> everywhere.  And I mean *everywhere*.

Can't you just make:

        sub TODO (\&) {
                local($INSIDE_TODO) = 1;
                TODO: shift->();
        }

        ...

        ok( 2 + 2 == 5);
        TODO {
                todo("some stuff");

                last TODO if $condition;

                ok( some_unfinished_func(42 == 23);
        };

        ok("foo" eq "bar");

It's close enough to a named block. :)


-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

Reply via email to