On 7/15/07, David Carlton <carlton / bactrian.org> wrote:

> Yeah, that's a good point - makes a lot of sense when you put it it
> that way.  In fact, maybe the weirdness is that the code _does_ do
> anything, given that it's only class and method definitions!  I admit
> that it's convenient that Test::Unit runs tests without being told
> when it sees them, but it's still a strange blurring of boundaries...

Aha.  That makes sense.  Test::Unit uses a special collector to do
that, which is why if you want to embed tests in a file, you should
always wrap them with something like:

if __FILE__ == $PROGRAM_NAME
  #...
end

to keep them from being run when required as a library.  However, in
their test files, you can just work from the main project dir or use
the -I flag to modify the include path.

Hope that helps,
-greg