From: Mark Van Holstyn Date: 2008-04-15T09:40:24+09:00 Subject: Re: Basics to test Unit ------=_Part_40810_2917141.1208220017395 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline Local variables defined in foo.rb will not be available in test_foo.rb. Mark 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 > > # foo.rb > x = `df`.grep(/^\/dev/).sort # in order of dev name > > # test_foo.rb > require 'test/unit' > require '/path/to/foo.rb' > > # test that the df cmd exists on the system that we are running it on > # output of cmd is put in array. this array should NOT be !!--empty--!! > > class TESTX < Test::Unit::TestCase > def test_no_df > assert(x.empty?, "df command not found") > end > end > > - jjm > > -- Mark Van Holstyn, Partner / Software Developer mvanholstyn@mutuallyhuman.com, (616) 706-6842 Mutually Human Software, http://mutuallyhuman.com ------=_Part_40810_2917141.1208220017395--