From: Nathaniel Talbott Date: 2002-03-20T12:05:32+09:00 Subject: RE: another Test::Unit question Massimiliano Mirra [mailto:list@chromatic-harp.com] wrote: > On Wed, Mar 20, 2002 at 08:44:23AM +0900, Nathaniel Talbott wrote: > > Hmmm... an easy way to specify the runner used by the at_exit trick > > would almost eliminate the need to ever create one's own suite, as > > well as getting rid of all valid excuses for the __FILE__ == $0 junk. > > Added to the TODO. > > I did not follow this from the beginning and am a little > worried. I usually write my lib classes like this: > > class Blah > ... > end > > if __FILE__ == $0 > require 'test/unit' > > class TestBlah < Test::Unit::TestCase > ... > end > end > > > If the __FILE__ == $0 part goes away, would the test run > always? Would it have to be kept in a separate file? This would still work fine, and would remain a perfectly valid way of doing things. The enhancement I was talking about would simplify life for those (like myself) that keep tests and code in separate files, by keeping them from ever having to specify __FILE__ == $0 in the test file to get the tests to execute using their choice of runner. > I hope not, since a great deal of speed in development for me > is given by modifying the class or the test and rerunning it > immediately inside emacs, with no load/save cycle. Actually defining the tests in the __FILE__ == $0 block is an interesting approach, and not one that I've seen before. One question, out of curiosity: how do you roll up a set of tests so that you can run them all at the same time? It seems that the tests don't even exist unless you're actually executing the file with the test in it. Do you ever run all the tests at once? Sorry for any worry and/or confusion I created, Nathaniel <:((>< + - - | RoleModel Software, Inc. | EQUIP VI