From: David Carlton Date: 2007-07-16T10:00:21+09:00 Subject: Re: weirdness with ruby unit testing on mac On Mon, 16 Jul 2007 09:49:33 +0900, "Gregory Brown" said: > On 7/15/07, David Carlton wrote: >> I guess I'm curious why using require is good in ruby files but bad >> from the command line. Or is it bad in files too? (And, if so, >> what's the replacement?) Is it just an issue of what's idiomatic >> (no problem with that, idioms are important), or am I missing >> something deeper? > Oh, it's not really bad in either. The issue is you're not trying to > require code, you're trying to run it. Require is used to load just > once, usually to load in libraries. > So what you are doing works fine, but it's unidiomatic. When you do a > require, you usually won't expect the code to *do* anything besides > load class definitions and the like. 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... Thanks for the insight, David Carlton carlton@bactrian.org