Re: [Perlunit-devel] compile errors and Loader
Status: Beta
Brought to you by:
mca1001
From: Piers C. <pdc...@bo...> - 2001-11-15 19:42:29
|
Adam Spiers <ad...@sp...> writes: > Test::Unit::Loader is doing all the work of compiling in suites and > cases etc., and mostly works very nicely. However, the load() method > has an oddity: > > } elsif ($@ !~ /^Can\'t locate .* in \@INC \(\@INC contains/) { > die $@; > } else { > print "Debug: ".$@ if DEBUG; > } > > which means that if your test case tries to use another module > unsuccessfully (e.g. if the module name has a typo), then it falls > through the above block without doing anything (except outputting some > debugging if DEBUG is on). That means the user sees: > > >> Tests::GGconfig > (This error is expected) Suite class Tests::GGconfig not found: Can't > locate GGconfg.pm in @INC (@INC contains: ..... > > which is misleading. Changing that code to > > } else { > die $@; > } > > yields: > > >> Tests::GGconfig > Can't locate GGconfg.pm in @INC (@INC contains: ..... > > which is exactly what the user needs to see. What was the reasoning > behind hiding those "Can't locate" errors? Not sure. Maybe the idea is to carry on and run what you can, but it seems like it's not winning us anything. If you change it to die, do any tests fail that would otherwise have passed. If no tests fail, write a test to exercise the new behaviour, and commit the changes. Hmm... maybe we could use a 'run a new perl with this code' type test method... -- Piers "It is a truth universally acknowledged that a language in possession of a rich syntax must be in need of a rewrite." -- Jane Austen? |