Hi Gabor, On 07/22/2012 10:44 PM, Gabor Szabo wrote: > when something fails Test::More of Perl 5 can tell me which line in > the test file it was called. > > I see the Backtrace module could supply this information. > The question if it would be ok if I tried to add this to the Test.pm module?
I'd appreciate that. However note that Backtrace gives you an unfiltered, low-level backtrace -- probably not what you want. (The reason is simply that filtering the backtrace is rather error-prone, so we need to make the raw data available somehow. In retrospect I could have found a better design for that...) Anyway, a filtered, much nicer backtrace is being calculated in method nice in src/core/Backtrace.pm just before 'return @frames.join' in the @frames variables -- it's just not exposed to the user space. Feel free to factor that into a separate method, so that method nice reduces to self.filtered.join or so. You might or might not want to check $frame.code.package to see if you're still in Test.pm -- I don't know what's the best way to make this work for test functions not from Test.pm (for example Test::Util in the roast repo has additional test functions; but catering to the core test functions would already be a big plus). Cheers, Moritz