But some didn't. In those cases, I got errors you know along the lines
t/025_some_test............ok 1/256 + # Failed test in t/025_some_test.t at line 7235. # got: 'FOO' # expected: 'BAR' # Looks like you failed 1 test of 256. t/025_some_test............dubious + Test returned status 1 (wstat 256, 0x100) DIED. FAILED test 123
OK, fine. Invoke $EDITOR and look at line 7235. Maybe you can figure what went wrong. Maybe you can't, because the module's author has been a bit too terse for your knowledge. You could get hints from the SYNOPSIS section of the module's pod, but sometimes you just won't without grokking the entire module.
Now, as test files are valid perl files, the author could have just placed some pod along the lines of their test files. Wouldn't that be handy? You could then just say perldoc t/025_some_test.t and get a description about the test being performed, see which test does what, and an explanation of the test and maybe failure conditions. Since writing test files requires some thinking, the thoughts could just be documented by writing them as pod sections into the test files whilst composing those files. The script h2xs could write stubs for that into the initial test file.
I would advocate documenting test scripts as a First Best Practice for module authors. What do you think about it?
--shmem
update: Test files (could) give much more insight into a module's usage than can ever be placed into a module's pod without it being overburdened. That's another reason.
_($_=" "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}
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: document your test files
by davidrw (Prior) on Jul 30, 2006 at 03:28 UTC | |
|
Re: document your test files
by Aristotle (Chancellor) on Jul 29, 2006 at 22:40 UTC | |
by Anonymous Monk on Jul 31, 2006 at 14:34 UTC | |
|
Re: document your test files
by creamygoodness (Curate) on Jul 30, 2006 at 01:59 UTC | |
by DrHyde (Prior) on Jul 31, 2006 at 09:45 UTC | |
by grantm (Parson) on Jul 31, 2006 at 09:12 UTC | |
|
Re: document your test files
by adrianh (Chancellor) on Jul 30, 2006 at 11:12 UTC | |
|
Re: document your test files
by gellyfish (Monsignor) on Jul 30, 2006 at 08:08 UTC | |
|
Re: document your test files
by eyepopslikeamosquito (Archbishop) on Jul 30, 2006 at 01:18 UTC | |
|
Re: document your test files
by n00dles (Novice) on Jul 30, 2006 at 14:40 UTC | |
|
Re: document your test files
by rvosa (Curate) on Aug 02, 2006 at 20:30 UTC |