diff --git a/test/Rakefile b/test/Rakefile index 463c7a9a1..3918d127e 100644 --- a/test/Rakefile +++ b/test/Rakefile @@ -1,68 +1,69 @@ require 'rake/testtask' require 'find' include Find include FileTest $exclusions = %W(lib data) +$test_library_paths = %W(lib ../lib) $test_dirs = [] # this is used to generate all the targets. $test_files = [] # this is ONLY used for the top-level test suite. # Collect all of our test directories, skipping specifically excluded dirs. $test_dirs = Dir.glob("*").find_all { |f| directory?(f) }.reject { |d| $exclusions.include?(File.basename(d)) } # another find for the test files themselves: this could probably be rolled # into the original find loop. $test_dirs.each do |dir| find(dir) do |path| if File.basename(path) =~ /^\.+/ prune elsif path != dir and ! directory?(path) $test_files.push path end end end desc "Run the full test suite" Rake::TestTask.new 'test' do |t| - t.libs << 'lib' + t.libs << $test_library_paths t.test_files = $test_files.sort t.verbose = true end #task :test => $test_dirs task :default => :test $test_dirs.sort.each do |path| files = [] find(path) do |file| if directory? file and path != file prune elsif file =~ /.rb$/ files.push file end end Rake::TestTask.new path.to_sym do |t| - t.libs << 'lib' + t.libs << $test_library_paths t.test_files = files.sort t.verbose = true end # task path.to_sym => files.collect { |x| path + ':' + File.basename(x, '.rb') } namespace path.to_sym do files.each do |file| Rake::TestTask.new File.basename(file, '.rb').to_sym do |t| - t.libs << '..' + t.libs << $test_library_paths + ['..'] t.test_files = [ file ] t.verbose = true end end end end # $Id$