in reply to Re: Test Blocks and skipping
in thread Test Blocks and skipping

Not sure how this would help.

Effectively what I want is for this
step a; testBlock("Block1",checkSomething) step b; }
to work like
step a; if(checkSomething){ step b; }else{ print "Not running step b as checkSomething failed" }
Hope that makes things clearer

Replies are listed 'Best First'.
Re^3: Test Blocks and skipping
by tilly (Archbishop) on Oct 17, 2006 at 00:08 UTC
    So what you want to do is invent a programming language, and make it work by parsing it then translating it to Perl. If the language is simple, that shouldn't be that hard to do.

    However you want to make it not look like a programming language. And you want it to be capable. And you don't want to let your users know that they are actually programming. Oh, and you want to be able to extend the language easily.

    That's a hard problem. And it is mostly a psychological one. What I'd suggest doing is a lot of whiteboarding. Write up samples of what people should write and what it would do. Go over it with users. When you have something mutually acceptable, then write a filter to turn that into Perl code. (Filter::Simple may help.)

    You can then make it extensible by having some command in your new language that loads a Perl module that adds new functions. :-)

Re^3: Test Blocks and skipping
by shmem (Chancellor) on Oct 16, 2006 at 23:53 UTC
    step a; testBlock("Block1",checkSomething) step b; }

    What does the unbalanced curly right bracket mean?

    The closest I can whip up - with a bit of syntax change - is

    sub checkSomething { 0 } sub testBlock (**&) { my ($block,$cond,$sub) = @_; my $test = &{$cond}; $test ? &$sub : warn "not running code for $block since '$cond' fa +iled \n"; } testBlock "Block1", 'checkSomething', sub { print "done\n"; # or another test };

    But I do ask - what good is it to provide test suites for somebody who doesn't grok if/else, and what could that target user possibly debug?

    --shmem

    _($_=" "x(1<<5)."?\n".q·/)Oo.  G°\        /
                                  /\_¯/(q    /
    ----------------------------  \__(m.====·.(_("always off the crowd"))."·
    ");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}