[Rake-devel] Test organization

Berger, Daniel Daniel.Berger at qwest.com
Mon May 2 15:18:30 EDT 2005

Hi all,

I have a few suggestions for the test suite:

1) Please move each test case into its own file.  Having multiple test
cases in the same file is confusing the heck out of me.

2) Add this bit of code to the top of each test file:

base = File.basename(Dir.pwd)
if base == "test" || base =~ /rake.*/
   require "ftools"
   Dir.chdir("..") if base == "test"
   $LOAD_PATH.unshift(Dir.pwd + "/lib")
   $LOAD_PATH.unshift(Dir.pwd + "/lib/rake")

This does a couple things.  First, tweaking the $LOAD_PATH ensures that
you're testing against the current version instead of a previously
installed version you might have laying around.  Second, it lets me run
the tests from either the base rake directory or from within the test
directory, i.e. "ruby test\testtasks.rb" (from the base rake directory)
or "ruby testtasks.rb" (from within rake\test).

3) Give me a test_all.rb that allows me to run all tests at once.  Or is
there something like that already?  I didn't see it.

4) Nitpick: can we please put underscores in the test file names?  e.g.
test_tasks.rb instead of testtasks.rb.  It's just easier on my eyes. :)



More information about the Rake-devel mailing list