From: Craig Demyanovich Date: 2008-04-14T00:15:27+09:00 Subject: Re: Basics to test Unit ------=_Part_2065_1103870.1208099724730 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline On Sun, Apr 13, 2008 at 9:54 AM, John Maclean wrote: > =begin > Can the Test unit be used to test methods or variables in other files? > I've > come across this reference, (http://clarkware.com/cgi/blosxom/2005/03/18), > which seems to test snipets of code within the test itself. The idea is to > test that the array x is not empty nd use the Test Unit to do it. > =end In that article, Mike is testing Ruby's String class in order to learn Ruby. (That's an effective way to learn a language, by the way.) Since Ruby already defines that class, he only has to write tests. When you're writing both the test and production code, you'll almost always put them in two separate files. For convenience, though, you can put test and production code in the same file. You might do this, for example, when you want to try something quickly or when you want to include a small example in an article or blog post. Regards, Craig ------=_Part_2065_1103870.1208099724730--