Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Hello monks,
I'm trying to submit a patch to the tests for an open-source project, and I'm not quite sure how to proceed. What I have are two test files:
t/test1.t t/test1_a.t
The second test file just "calls" the first with a specific set of parameters, so it's entire code is:
system "perl t/test1.t -a qqq -b 1";
The problem is that test1_a.t should be skipped if a given module is missing. So I tried:
BEGIN { $error = 0; # foo:bar is required eval { require foo::bar; }; if ( $@ ) { warn "foo::bar is not installed or is installed incorr +ectly - skipping test1_a.t"; $error = 1; } } exit(0) if ( $error == 1 ); system "perl t/test1.t -a qqq -b 1";
This doesn't run the tests, but it also doesn't quite work because when I run it through the test harness I get:
t/test1_a......foo::bar is not installed or is installed incorrectly - + skipping test1_a.t at t/test1_a.t line 13. FAILED before any test output arrived
Whereas what I would like to get is more like:
t/test1_a........................foo::bar is not installed or is insta +lled incorrectly - skipping test1_a.t
Can anyone offer guidance here? Hope I've given enough details.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Skipping a chained test
by merlyn (Sage) on Oct 17, 2006 at 21:04 UTC | |
|
Re: Skipping a chained test
by philcrow (Priest) on Oct 17, 2006 at 21:02 UTC |