blob: 3918d127ef927372238f3e6788bf1ee42e28363b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
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 << $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 << $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 << $test_library_paths + ['..']
t.test_files = [ file ]
t.verbose = true
end
end
end
end
# $Id$
|