Re: [Perlunit-devel] Teensy PerlUnit suggestion, and a question
Status: Beta
Brought to you by:
mca1001
From: Adam S. <ad...@sp...> - 2002-03-18 14:28:08
|
Matthias Ferber (mf...@hi...) wrote: > Er, question first, shall we? I wonder if you have a recommendation for > how to approach the problem I'm trying to solve, given PerlUnit's current > architecture. I want to be able to start a TestRunner running against a > dynamically generated suite, where the suite itself is determined by the > command line. > > So, for instance, I imagine the command line looking something like this: > > perl TestRunner.pl MyTestMaker arg1 arg2.... > > where MyTestMaker has a suite() method that uses the arguments to generate > the appropriate test suite. The thing is, there's no way for MyTestMaker > to get access to the arguments, because they're all eaten up by TestRunner > and not passed along. Is there another way (a "right" way) to do this? > > My solution so far is to bypass TestRunner.pl, instead using a script that > generates the test suite, creates a new TestRunner object and starts it > running with the constructed suite. The two things I don't like about > this are that it relies on the TestRunner::do_run() method, which I'm not > sure is a public part of the API, and that I'd rather use TestRunner.pl if > at all possible. Any suggestions? I think you've done the right thing (in the context of the current PerlUnit tree, at least), and that do_run() should be part of the public API. If you wanted to extend the argument syntax of TestRunner.pl to allow parameters to be passed to tests, feel free to post a proposed syntax here. It looks like this part of PerlUnit needs a bit of a spring-clean; for instance, I can't see anything that uses TestRunner::run() or TestRunner::run_and_wait(). I'll add this to the TODO list. > OK, now my own small suggestion. I was confused at first when a Boolean > assertion failed with the message "Expected TRUE, got FALSE." Seems to me > that a Boolean test doesn't have an expected value the way an equality > assertion does; how about changing the message to "Assertion failed"? I've changed it to "Boolean assertion failed". -- Adam Spiers -=- musician & hacker -- ad...@sp... -=- http://tigerpig.org/ $_=q{*{$Just =bless{},'$another ';"\$Perl \::$hacker"}=sub{print$%[$.++];$,,$ ;$_[0]},eval join+v45.62,('$z')x6};s/(?<=\$)([a-z\n]+ ?)/push@%,$+;f/egi;eval |