On Wednesday 19 July 2006 10:35, Fergal Daly wrote: > A correctly documented bad user experience is still a bad user > experience. What possible justification is there for not being able to > easily use subroutines in test scripts?
Who broke your fingers? You can use subroutines in test scripts. If you write them badly, you get bad results -- the same as subroutines in any other programs and in any other language. If you don't want to get bad results, use the $Level variable or use the attribute solution Aristotle posted. > It's already done! Test::Builder already knows how to find where the > user script jumps into Test::XXX land. All I'm saying is that instead > of just outputting that 1 frame, output all the frame from there on up > (in this case 2). Neither magic nor rocket science. Do you *really* want to force everyone, everywhere to name their test modules Test::*, name none of their Test::Class-based tests anything starting with Test::, and wade through call stack output on every failure? Enforcing some sort of naming scheme for a heuristic to work seems like a mistake to me. > I'm not proposing elminating the local $blah stuff from Test::XXX > modules, just making it possible for users to get sensible messages > even if they use subroutines in their test scripts. I much prefer Aristotle's solution. Stack traces are scary. They're not common in Perl code I come across. > See above for why there is no dozen lines, Again, that depends on how far you push the heuristic. -- c