On Thursday 20 July 2006 13:50, Fergal Daly wrote: > Example code please.
You *quoted* my example code in multiple messages, including this one. > You're saying there's a situation where using > $Level produces the incorrect output. I'm saying there isn't. I don't know what else to call a stack trace that includes irrelevant and extra information due to an incorrect $Level except "incorrect". > Everything I'm saying is based on my opinion that $Level is reliable, > everything you're saying is based on your opinion that it is not > reliable. No, my opinion is that if people don't set $Level appropriately, it's not reliable. In that case, neither is the stack trace -- because the stack trace depends on $Level. I consider the stack trace less reliable and potentially more confusing, because it gives even more information and leaves it up to the user to pick out which piece of that information is correct, if any. You can give examples where it's correct accidentally, but I don't find "It's useful sometimes, by luck or accident" a compelling argument for changing the default behavior. There are already two features that work together to help people diagnose problems when they use them correctly. Why add a third feature that's noisier and even less reliable and relies on the correct use of an existing feature? The purpose of $Level and the line reporting is to be able to say "The call to a test function failed at this point". No less, no more. If people set $Level properly (and that's a big if), Test::Builder can report this accurately. The purpose of a test description is to be able to say "The purpose of this test is...." Test::Builder cannot guess at this. With the exception of very simple, special purpose test functions such as isa_ok() and can_ok() and perhaps lives_ok() and dies_ok(), I believe that knowing the *purpose* of the test is at least as important to debugging the test as knowing the location of the failure. Dumping a call stack is, to me, just guessing at the semantics and structure of the call stack in the hopes that it's useful. I don't think that's a valid assumption. If $Level is incorrect, who knows whether you're getting extra, meaningless call frames or too few call frames? It's not obviously right or wrong, and that's a real problem in testing. If we still disagree, that's fine; it's probably a philosophical disagreement. I really don't know how to be more clear in this. -- c