Randy W. Sims wrote:


The following works fine under 'nmake test' as a 'test.pl' in the top level folder:


-------------------------
if(1 == 1) {print "f1 ok\n"}
else {print "f1 not ok\n"}

if(2 == 2) {print "f2 ok\n"}
else {print "f2 not ok\n"}
------------------------

It prints:
f1 ok
f2 ok

which tells me all I want to know.


Are you not using Test or Test::* modules for your tests? Test::Harness was made to work with a certain format which the Test::* modules adhere to.


Yep - I've always considered (and still do) that the Test modules contribute very little (if anything) for either the author of the test scripts, or the person running the tests, so I've never bothered with them.


But change it to 'test.t' and move it from the top level to the 't' sub-directory, then nmake test produces:
t\aaaa.......... FAILED before any test output arrived


For it to work as a'.t' script you have to rewrite it as something like:

------------------
print "1..2\n";

$n = 1;

if(1 == 1) {print "ok $n\n"}
else {print "not ok $n\n"}
$n++;

if(2 == 2) {print "ok $n\n"}
else {print "not ok $n\n"}
$n++;
-----------------

Do that and you'll get:
t\aaaa..........ok

(You've probably noticed that when there's a 'test.t' file in a 't' sub-directory 'make test' produces different output to 'perl -Mblib t\test.t')

So it turns out that it's not a really big deal to rewrite my test scripts so that they work - I just find it annoying that I have to do that.

Not that it applies to my situation, but I also find it really annoying when running a test suite that reports test 711 of 893 failed - and I have to try and work out just which test that was and what it was testing.

I would much prefer to see test output like:
t\aaaa......
f1    ok
f2    ok
f3    ok
f4    ok
f5    not ok
f6    ok

t\bbbb......
fa    ok
.
.

where f1, f2, etc. are the actual name of the function being tested (and are hard coded). The function called 'f5' has failed so I can simply search aaaa.t for the string 'f5 not ok' and find out exactly where the failure has occurred.

That's much easier than doing a search for 'ok' and clicking on 'find next' 1422 times :-)

So I've never bothered keeping track of the number of tests performed by my 'test.pl' and now it looks like I'll have to suffer a little inconvenience as a result.


Have you tried: 'nmake test TEST_VERBOSE=1' or if it is in a specific file do 'nmake test TEST_FILES=t/test.t TEST_VERBOSE=1'


The first incantation does flush the output to the screen, but then adds "FAILED before any test output arrived" which makes for very confusing reading.
I haven't tried that second incantation. If there was only the one test file I would simply call it 'test.pl', place it in the top level folder, and all would be fine when I run 'make test'.


Thanks, Randy.
Seems like I might have to make those modifications if I want to run multiple test scripts - which I'm prepared to do ..... but only after having a little whinge :-)


Cheers,
Rob

--
Any emails containing attachments will be deleted from my ISP's mail server before I even get to see them. If you wish to email me an attachment, please provide advance warning so that I can make the necessary arrangements.


_______________________________________________
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to