From: "Mauricio Fernández" Date: 2003-03-01T06:27:20+09:00 Subject: Re: Test Unit help On Sat, Mar 01, 2003 at 06:05:43AM +0900, James Davis wrote: > I'm new to unit testing, and test-first development. Sometimes I > would like to run tests from within other tests rather than recoding > and maintaining a test in two places. Sometimes it helps to pass in > an argument as shown below. In Test::Unit 0.1.4, the first example > test_do_some_work(w=@worker) worked fine, but the second > test_do_more_work(w=@worker) failed to run. Now, in 0.1.8, both fail > to run. I'm using ruby 1.6.8 on Windows. Questions: Is this > behavior by design? Why? Is it a bad idea to do what I am trying? I'm fairly new to unit testing too, but this could solve the problem: def test_foo(w = nil) w ||= @worker w.bar(baz, quz, fubar) end I don't feel OK when I see an instance var. as a default value, not sure why. -- _ _ | |__ __ _| |_ ___ _ __ ___ __ _ _ __ | '_ \ / _` | __/ __| '_ ` _ \ / _` | '_ \ | |_) | (_| | |_\__ \ | | | | | (_| | | | | |_.__/ \__,_|\__|___/_| |_| |_|\__,_|_| |_| Running Debian GNU/Linux Sid (unstable) batsman dot geo at yahoo dot com Actually, typing random strings in the Finder does the equivalent of filename completion. -- Discussion on file completion vs. the Mac Finder