ZenTest 3.4.3 → 3.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/History.txt +46 -3
- data/Manifest.txt +13 -0
- data/README.txt +1 -0
- data/Rakefile +20 -3
- data/bin/autotest +23 -37
- data/bin/multiruby +13 -7
- data/bin/unit_diff +1 -1
- data/example_dot_autotest.rb +14 -0
- data/lib/autotest.rb +77 -30
- data/lib/autotest/autoupdate.rb +26 -0
- data/lib/autotest/emacs.rb +29 -0
- data/lib/autotest/fixtures.rb +12 -0
- data/lib/autotest/growl.rb +7 -17
- data/lib/autotest/heckle.rb +14 -0
- data/lib/autotest/migrate.rb +7 -0
- data/lib/autotest/notify.rb +38 -0
- data/lib/autotest/redgreen.rb +7 -4
- data/lib/autotest/screen.rb +77 -0
- data/lib/autotest/shame.rb +45 -0
- data/lib/autotest/timestamp.rb +3 -1
- data/lib/camping_autotest.rb +37 -0
- data/lib/functional_test_matrix.rb +85 -0
- data/lib/rails_autotest.rb +49 -41
- data/lib/rspec_rails_autotest.rb +119 -0
- data/lib/test/rails.rb +28 -1
- data/lib/test/rails/controller_test_case.rb +27 -6
- data/lib/test/rails/functional_test_case.rb +3 -0
- data/lib/test/rails/helper_test_case.rb +3 -0
- data/lib/test/rails/view_test_case.rb +13 -5
- data/lib/test/zentest_assertions.rb +42 -23
- data/lib/unit_diff.rb +86 -69
- data/lib/zentest.rb +58 -87
- data/lib/zentest_mapping.rb +97 -0
- data/test/test_autotest.rb +23 -3
- data/test/test_help.rb +10 -4
- data/test/test_rails_autotest.rb +6 -4
- data/test/test_rails_controller_test_case.rb +10 -2
- data/test/test_ruby_fork.rb +12 -12
- data/test/test_unit_diff.rb +37 -33
- data/test/test_zentest.rb +15 -141
- data/test/test_zentest_assertions.rb +38 -18
- data/test/test_zentest_mapping.rb +213 -0
- metadata +18 -4
data/History.txt
CHANGED
@@ -1,10 +1,53 @@
|
|
1
|
+
*** 3.5.1 / 2007-04-17
|
2
|
+
|
3
|
+
+ 4 bug fixes:
|
4
|
+
+ Fixed gem name to be camel-case again. Fixed on rubyforge too.
|
5
|
+
+ Fixed rdoc for hooks.
|
6
|
+
+ Fixed redgreen, results changed to an array.
|
7
|
+
+ Patch up Rails fixture defaults, since they're not inheriting properly.
|
8
|
+
|
9
|
+
*** 3.5.0 / 2007-04-12
|
10
|
+
|
11
|
+
+ 4 major enhancements:
|
12
|
+
+ Now requires RubyGems 0.9.1 or newer.
|
13
|
+
+ Autotest and unit_diff are both unbuffered. Results are more live.
|
14
|
+
+ Refactored and redesigned how files map to test from Sean Carley. See fixtures plugin as an example.
|
15
|
+
+ Generalize how autotest handler is instantiated and invoked, allowing for many more autotest types, including combos.
|
16
|
+
+ 23 minor enhancements:
|
17
|
+
+ Added all_good hook if initial run was all_good as well.
|
18
|
+
+ Added assert_in_epsilon to ZentestAssertions.
|
19
|
+
+ Added autotest plugin to auto-update source ala tinderbox/cruisecontrol.
|
20
|
+
+ Added autotest plugin to update ichat/adium IM status with code stats.
|
21
|
+
+ Added autotest plugin to update the GNU screen statusbar from Yuichi Tateno.
|
22
|
+
+ Added autotest syntax error handling from Ryan Platte.
|
23
|
+
+ Added autotest/emacs emacs integration plugin!!! YAY!
|
24
|
+
+ Added autotest/migrate.rb.
|
25
|
+
+ Added camping support from Geoffrey Grossenbach.
|
26
|
+
+ Added changed file reporting to autotest via -v flag.
|
27
|
+
+ Added informative summary and filtering via ENV['VERSIONS'] to multiruby.
|
28
|
+
+ Added libnotify support from Kazuo Saito.
|
29
|
+
+ Added lots of rdoc patches from Hugh Sasse.
|
30
|
+
+ Added rjs files to view_test_case.
|
31
|
+
+ Added rspec_autotest "stolen" from caldersphere.net
|
32
|
+
+ Added run_command hook to trigger the start of a test run.
|
33
|
+
+ Added tmp to rails' exceptions list.
|
34
|
+
+ Added unit_diff command variable to autotest for customizing flags and such.
|
35
|
+
+ Added zentest_mapping.rb and test.
|
36
|
+
+ Allow session to work in Test::Rails view tests.
|
37
|
+
+ Improved autotest/growl.rb output from imajes.
|
38
|
+
+ Improved autotest/timestamp output from Josh Susser.
|
39
|
+
+ Test::Rails works with Rails 1.2.
|
40
|
+
+ 2 bug fixes:
|
41
|
+
+ Accelerated Test::Rails unit tests via sensible defaults.
|
42
|
+
+ Better assertion messages for ZentestAssertions.
|
43
|
+
|
1
44
|
*** 3.4.3 / 2006-12-19
|
2
45
|
|
3
46
|
+ 2 minor enhancements:
|
4
|
-
|
47
|
+
+ Add assert_title and assert_h (for header).
|
5
48
|
+ 2 bug fixes:
|
6
|
-
|
7
|
-
|
49
|
+
+ Rereleased against latest version of hoe to fix load path problems.
|
50
|
+
+ Fix case ViewTestCase for case-sensitive file systems.
|
8
51
|
|
9
52
|
*** 3.4.2 / 2006-11-09
|
10
53
|
|
data/Manifest.txt
CHANGED
@@ -15,15 +15,26 @@ example1.rb
|
|
15
15
|
example2.rb
|
16
16
|
example_dot_autotest.rb
|
17
17
|
lib/autotest.rb
|
18
|
+
lib/autotest/autoupdate.rb
|
19
|
+
lib/autotest/emacs.rb
|
20
|
+
lib/autotest/fixtures.rb
|
18
21
|
lib/autotest/growl.rb
|
22
|
+
lib/autotest/heckle.rb
|
19
23
|
lib/autotest/html_report.rb
|
20
24
|
lib/autotest/kdenotify.rb
|
21
25
|
lib/autotest/menu.rb
|
26
|
+
lib/autotest/migrate.rb
|
27
|
+
lib/autotest/notify.rb
|
22
28
|
lib/autotest/pretty.rb
|
23
29
|
lib/autotest/redgreen.rb
|
30
|
+
lib/autotest/screen.rb
|
31
|
+
lib/autotest/shame.rb
|
24
32
|
lib/autotest/snarl.rb
|
25
33
|
lib/autotest/timestamp.rb
|
34
|
+
lib/camping_autotest.rb
|
35
|
+
lib/functional_test_matrix.rb
|
26
36
|
lib/rails_autotest.rb
|
37
|
+
lib/rspec_rails_autotest.rb
|
27
38
|
lib/ruby_fork.rb
|
28
39
|
lib/test/rails.rb
|
29
40
|
lib/test/rails/controller_test_case.rb
|
@@ -38,6 +49,7 @@ lib/test/rails/view_test_case.rb
|
|
38
49
|
lib/test/zentest_assertions.rb
|
39
50
|
lib/unit_diff.rb
|
40
51
|
lib/zentest.rb
|
52
|
+
lib/zentest_mapping.rb
|
41
53
|
test/test_autotest.rb
|
42
54
|
test/test_help.rb
|
43
55
|
test/test_rails_autotest.rb
|
@@ -48,3 +60,4 @@ test/test_ruby_fork.rb
|
|
48
60
|
test/test_unit_diff.rb
|
49
61
|
test/test_zentest.rb
|
50
62
|
test/test_zentest_assertions.rb
|
63
|
+
test/test_zentest_mapping.rb
|
data/README.txt
CHANGED
data/Rakefile
CHANGED
@@ -1,14 +1,12 @@
|
|
1
1
|
# -*- ruby -*-
|
2
2
|
|
3
|
-
|
3
|
+
$: << 'lib'
|
4
4
|
|
5
5
|
require 'rubygems'
|
6
6
|
require 'hoe'
|
7
7
|
require './lib/zentest.rb'
|
8
8
|
|
9
9
|
Hoe.new("ZenTest", ZenTest::VERSION) do |p|
|
10
|
-
paragraphs = File.read("README.txt").split(/\n\n+/)
|
11
|
-
|
12
10
|
p.author = ['Ryan Davis', 'Eric Hodel']
|
13
11
|
|
14
12
|
changes = p.paragraphs_of("History.txt", 0..1).join("\n\n")
|
@@ -23,6 +21,25 @@ task :autotest do
|
|
23
21
|
ruby "-Ilib ./bin/autotest"
|
24
22
|
end
|
25
23
|
|
24
|
+
task :update do
|
25
|
+
File.open "example_dot_autotest.rb", "w" do |f|
|
26
|
+
f.puts "# -*- ruby -*-"
|
27
|
+
f.puts
|
28
|
+
Dir.chdir "lib" do
|
29
|
+
Dir["autotest/*.rb"].sort.each do |s|
|
30
|
+
f.puts "# require '#{s[0..-4]}'"
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
f.puts
|
35
|
+
f.puts "# Autotest::AutoUpdate.sleep_time = 60"
|
36
|
+
f.puts "# Autotest::AutoUpdate.update_cmd = 'svn up'"
|
37
|
+
f.puts "# Autotest::Heckle.flags << '-t test/**/*.rb'"
|
38
|
+
f.puts "# Autotest::Heckle.klasses << 'MyClass'"
|
39
|
+
f.puts "# Autotest::Shame.chat_app = :adium"
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
26
43
|
task :sort do
|
27
44
|
begin
|
28
45
|
sh 'for f in lib/*.rb; do echo $f; grep "^ *def " $f | grep -v sort=skip > x; sort x > y; echo $f; echo; diff x y; done'
|
data/bin/autotest
CHANGED
@@ -1,50 +1,36 @@
|
|
1
1
|
#!/usr/local/bin/ruby -ws
|
2
2
|
|
3
|
+
$v ||= false
|
3
4
|
$h ||= false
|
4
5
|
$help ||= false
|
5
6
|
|
6
7
|
if $h or $help then
|
7
|
-
help = [
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
help << "\t-rails\t\tForce rails mode."
|
19
|
-
help << "\t\t\tRails will be automatically detected by the presence of"
|
20
|
-
help << "\t\t\tconfig/environment.rb. Use this if you don't have one."
|
21
|
-
help << nil
|
22
|
-
help << "\t\t\tYou may need to run 'rake db:test:prepare' before"
|
23
|
-
help << "\t\t\tstarting autotest on a rails project."
|
24
|
-
help << nil
|
25
|
-
help << "\t-vcs=NAME\tVersion control system to update."
|
26
|
-
help << "\t\t\tAutotest will automatically update every vcstime"
|
27
|
-
help << "\t\t\tseconds."
|
28
|
-
help << "\t\t\tAutotest understands Perforce (p4), CVS (cvs) and"
|
29
|
-
help << "\t\t\tSubversion (svn)."
|
30
|
-
help << nil
|
31
|
-
help << "\t-vcstime=N\tUpdate source control every N seconds."
|
32
|
-
help << "\t\t\tDefaults to every five minutes (300 seconds)."
|
8
|
+
help = [
|
9
|
+
"autotest [options]",
|
10
|
+
nil,
|
11
|
+
"options:",
|
12
|
+
"\t-h",
|
13
|
+
"\t-help\t\tYou're looking at it.",
|
14
|
+
nil,
|
15
|
+
"\t-v\t\tBe verbose.",
|
16
|
+
"\t\t\tPrints files that autotest doesn't know how to map to",
|
17
|
+
"\t\t\ttests.",
|
18
|
+
]
|
33
19
|
STDERR.puts help.join("\n")
|
34
20
|
exit 1
|
35
21
|
end
|
36
22
|
|
37
|
-
$
|
23
|
+
$rspec ||= false
|
38
24
|
$rails ||= false
|
39
|
-
$
|
40
|
-
$vcstime ||= 300
|
41
|
-
$vcstime = $vcstime.to_i
|
25
|
+
$camping ||= false
|
42
26
|
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
Autotest.run
|
49
|
-
end
|
27
|
+
style = []
|
28
|
+
style << "rspec" if $rspec or File.directory?('spec')
|
29
|
+
style << "rails" if $rails or File.exist? 'config/environment.rb'
|
30
|
+
style << "camping" if $camping or File.exist? 'test/camping_test_case.rb'
|
31
|
+
style << "autotest"
|
50
32
|
|
33
|
+
mod = style.join("_")
|
34
|
+
puts "loading #{mod}"
|
35
|
+
require mod
|
36
|
+
Object.const_get(style.map {|s| s.capitalize}.join).run
|
data/bin/multiruby
CHANGED
@@ -18,12 +18,12 @@ Dir.chdir root_dir do
|
|
18
18
|
%w(build install versions).each do |dir|
|
19
19
|
unless test ?d, dir then
|
20
20
|
puts "creating #{dir}"
|
21
|
-
Dir.mkdir dir
|
21
|
+
Dir.mkdir dir
|
22
22
|
if dir == "versions" then
|
23
23
|
file = "ruby-#{RUBY_VERSION}.tar.gz"
|
24
24
|
puts " downloading #{file} via HTTP... this might take a while."
|
25
25
|
puts " Put other ruby tarballs in versions to use them."
|
26
|
-
|
26
|
+
|
27
27
|
Dir.chdir dir do
|
28
28
|
require 'open-uri'
|
29
29
|
open("http://ftp.ruby-lang.org/pub/ruby/#{file}") do |f|
|
@@ -77,7 +77,10 @@ Dir.chdir root_dir do
|
|
77
77
|
end
|
78
78
|
end
|
79
79
|
|
80
|
-
|
80
|
+
versions = ENV['VERSIONS'].split(/:/) if ENV.has_key? 'VERSIONS'
|
81
|
+
|
82
|
+
results = {}
|
83
|
+
versions.each do |version|
|
81
84
|
ruby = "#{root_dir}/install/#{version}/bin/ruby"
|
82
85
|
puts
|
83
86
|
puts "VERSION = #{version}"
|
@@ -85,12 +88,15 @@ results = versions.map do |version|
|
|
85
88
|
system ruby, *ARGV
|
86
89
|
puts
|
87
90
|
puts "RESULT = #{$?}"
|
88
|
-
$?
|
91
|
+
results[version] = $?
|
89
92
|
end
|
90
93
|
|
91
|
-
|
94
|
+
passed, failed = results.keys.partition { |v| results[v] == 0 }
|
92
95
|
|
93
96
|
puts
|
94
|
-
puts "TOTAL RESULT = #{
|
97
|
+
puts "TOTAL RESULT = #{failed.size} failures out of #{results.size}"
|
98
|
+
puts
|
99
|
+
puts "Passed: #{passed.join(", ")}"
|
100
|
+
puts "Failed: #{failed.join(", ")}"
|
95
101
|
|
96
|
-
exit
|
102
|
+
exit failed.size
|
data/bin/unit_diff
CHANGED
data/example_dot_autotest.rb
CHANGED
@@ -1,10 +1,24 @@
|
|
1
1
|
# -*- ruby -*-
|
2
2
|
|
3
|
+
# require 'autotest/autoupdate'
|
4
|
+
# require 'autotest/emacs'
|
5
|
+
# require 'autotest/fixtures'
|
3
6
|
# require 'autotest/growl'
|
7
|
+
# require 'autotest/heckle'
|
4
8
|
# require 'autotest/html_report'
|
5
9
|
# require 'autotest/kdenotify'
|
6
10
|
# require 'autotest/menu'
|
11
|
+
# require 'autotest/migrate'
|
12
|
+
# require 'autotest/notify'
|
7
13
|
# require 'autotest/pretty'
|
8
14
|
# require 'autotest/redgreen'
|
15
|
+
# require 'autotest/screen'
|
16
|
+
# require 'autotest/shame'
|
9
17
|
# require 'autotest/snarl'
|
10
18
|
# require 'autotest/timestamp'
|
19
|
+
|
20
|
+
# Autotest::AutoUpdate.sleep_time = 60
|
21
|
+
# Autotest::AutoUpdate.update_cmd = 'svn up'
|
22
|
+
# Autotest::Heckle.flags << '-t test/**/*.rb'
|
23
|
+
# Autotest::Heckle.klasses << 'MyClass'
|
24
|
+
# Autotest::Shame.chat_app = :adium
|
data/lib/autotest.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
require 'find'
|
2
2
|
require 'rbconfig'
|
3
3
|
|
4
|
+
$v ||= false
|
4
5
|
$TESTING = false unless defined? $TESTING
|
5
6
|
|
6
7
|
##
|
@@ -27,8 +28,8 @@ $TESTING = false unless defined? $TESTING
|
|
27
28
|
#
|
28
29
|
# Autotest.add_hook hook_name { |autotest| ... }
|
29
30
|
#
|
30
|
-
# The available hooks are:
|
31
|
-
# green, all_good, and
|
31
|
+
# The available hooks are: initialize, run, run_command, ran_command,
|
32
|
+
# red, green, all_good, reset, interrupt, and quit.
|
32
33
|
#
|
33
34
|
# See example_dot_autotest.rb for more details.
|
34
35
|
#
|
@@ -62,7 +63,18 @@ class Autotest
|
|
62
63
|
new.run
|
63
64
|
end
|
64
65
|
|
65
|
-
attr_accessor
|
66
|
+
attr_accessor(:exceptions,
|
67
|
+
:files,
|
68
|
+
:files_to_test,
|
69
|
+
:interrupted,
|
70
|
+
:last_mtime,
|
71
|
+
:libs,
|
72
|
+
:output,
|
73
|
+
:results,
|
74
|
+
:tainted,
|
75
|
+
:test_mappings,
|
76
|
+
:unit_diff,
|
77
|
+
:wants_to_quit)
|
66
78
|
|
67
79
|
def initialize
|
68
80
|
@files = Hash.new Time.at(0)
|
@@ -71,6 +83,17 @@ class Autotest
|
|
71
83
|
@libs = %w[. lib test].join(File::PATH_SEPARATOR)
|
72
84
|
@output = $stderr
|
73
85
|
@sleep = 1
|
86
|
+
@unit_diff = "unit_diff -u"
|
87
|
+
|
88
|
+
@test_mappings = {
|
89
|
+
/^lib\/.*\.rb$/ => proc { |filename, _|
|
90
|
+
files_matching %r%^test/.*#{File.basename(filename).gsub '_', '_?'}$%
|
91
|
+
},
|
92
|
+
/^test\/test_.*rb$/ => proc { |filename, _|
|
93
|
+
filename
|
94
|
+
}
|
95
|
+
}
|
96
|
+
|
74
97
|
hook :initialize
|
75
98
|
end
|
76
99
|
|
@@ -82,7 +105,11 @@ class Autotest
|
|
82
105
|
loop do # ^c handler
|
83
106
|
begin
|
84
107
|
get_to_green
|
85
|
-
|
108
|
+
if @tainted then
|
109
|
+
rerun_all_tests
|
110
|
+
else
|
111
|
+
hook :all_good
|
112
|
+
end
|
86
113
|
wait_for_changes
|
87
114
|
rescue Interrupt
|
88
115
|
if @wants_to_quit then
|
@@ -106,11 +133,30 @@ class Autotest
|
|
106
133
|
find_files_to_test # failed + changed/affected
|
107
134
|
cmd = make_test_cmd @files_to_test
|
108
135
|
|
136
|
+
hook :run_command
|
109
137
|
puts cmd
|
110
138
|
|
111
|
-
|
139
|
+
old_sync = $stdout.sync
|
140
|
+
$stdout.sync = true
|
141
|
+
@results = []
|
142
|
+
line = []
|
143
|
+
begin
|
144
|
+
open("| #{cmd}", "r") do |f|
|
145
|
+
until f.eof? do
|
146
|
+
c = f.getc
|
147
|
+
putc c
|
148
|
+
line << c
|
149
|
+
if c == ?\n then
|
150
|
+
@results << line.pack("c*")
|
151
|
+
line.clear
|
152
|
+
end
|
153
|
+
end
|
154
|
+
end
|
155
|
+
ensure
|
156
|
+
$stdout.sync = old_sync
|
157
|
+
end
|
112
158
|
hook :ran_command
|
113
|
-
|
159
|
+
@results = @results.join
|
114
160
|
|
115
161
|
handle_results(@results)
|
116
162
|
end
|
@@ -165,7 +211,6 @@ class Autotest
|
|
165
211
|
result = {}
|
166
212
|
Find.find '.' do |f|
|
167
213
|
Find.prune if @exceptions and f =~ @exceptions and test ?d, f
|
168
|
-
Find.prune if f =~ /(\.(svn|hg)|CVS|tmp|public|doc|pkg)$/ # prune dirs
|
169
214
|
|
170
215
|
next if test ?d, f
|
171
216
|
next if f =~ /(swp|~|rej|orig)$/ # temporary/patch files
|
@@ -183,6 +228,8 @@ class Autotest
|
|
183
228
|
@files[filename] < mtime
|
184
229
|
}
|
185
230
|
|
231
|
+
p updated if $v unless updated.empty? or @last_mtime.to_i == 0
|
232
|
+
|
186
233
|
# TODO: keep an mtime at app level and drop the files hash
|
187
234
|
updated.each do |filename, mtime|
|
188
235
|
@files[filename] = mtime
|
@@ -195,18 +242,18 @@ class Autotest
|
|
195
242
|
end
|
196
243
|
|
197
244
|
previous = @last_mtime
|
198
|
-
@last_mtime = @files.values.
|
245
|
+
@last_mtime = @files.values.max
|
199
246
|
@last_mtime > previous
|
200
247
|
end
|
201
248
|
|
202
249
|
def handle_results(results)
|
203
250
|
failed = results.scan(/^\s+\d+\) (?:Failure|Error):\n(.*?)\((.*?)\)/)
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
251
|
+
completed = results =~ /\d+ tests, \d+ assertions, \d+ failures, \d+ errors/
|
252
|
+
|
253
|
+
@files_to_test = consolidate_failures failed if completed
|
254
|
+
|
255
|
+
hook completed && @files_to_test.empty? ? :green : :red unless $TESTING
|
256
|
+
|
210
257
|
@tainted = true unless @files_to_test.empty?
|
211
258
|
end
|
212
259
|
|
@@ -215,12 +262,12 @@ class Autotest
|
|
215
262
|
full, partial = files_to_test.partition { |k,v| v.empty? }
|
216
263
|
|
217
264
|
unless full.empty? then
|
218
|
-
classes = full.map {|k,v| k}.flatten.join(' ')
|
219
|
-
cmds << "#{ruby} -I#{@libs} -rtest/unit -e \"%w[#{classes}].each { |f| require f }\" | unit_diff
|
265
|
+
classes = full.map {|k,v| k}.flatten.uniq.sort.join(' ')
|
266
|
+
cmds << "#{ruby} -I#{@libs} -rtest/unit -e \"%w[#{classes}].each { |f| require f }\" | #{unit_diff}"
|
220
267
|
end
|
221
268
|
|
222
269
|
partial.each do |klass, methods|
|
223
|
-
cmds << "#{ruby} -I#{@libs} #{klass} -n \"/^(#{Regexp.union(*methods).source})$/\" | unit_diff
|
270
|
+
cmds << "#{ruby} -I#{@libs} #{klass} -n \"/^(#{Regexp.union(*methods).source})$/\" | #{unit_diff}"
|
224
271
|
end
|
225
272
|
|
226
273
|
return cmds.join('; ')
|
@@ -241,7 +288,7 @@ class Autotest
|
|
241
288
|
@tainted = false
|
242
289
|
hook :reset
|
243
290
|
end
|
244
|
-
|
291
|
+
|
245
292
|
def ruby
|
246
293
|
ruby = File.join(Config::CONFIG['bindir'],
|
247
294
|
Config::CONFIG['ruby_install_name'])
|
@@ -254,18 +301,12 @@ class Autotest
|
|
254
301
|
end
|
255
302
|
|
256
303
|
def tests_for_file(filename)
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
when /^test\/test_.*rb$/ then
|
264
|
-
[filename]
|
265
|
-
else
|
266
|
-
@output.puts "Dunno! #{filename}" if $TESTING
|
267
|
-
[]
|
268
|
-
end
|
304
|
+
result = @test_mappings.find { |file_re, ignored| filename =~ file_re }
|
305
|
+
result = result.nil? ? [] : Array(result.last.call(filename, $~))
|
306
|
+
|
307
|
+
@output.puts "Dunno! #{filename}" if $TESTING and result.empty?
|
308
|
+
|
309
|
+
result.sort.uniq
|
269
310
|
end
|
270
311
|
|
271
312
|
def wait_for_changes
|
@@ -275,6 +316,12 @@ class Autotest
|
|
275
316
|
end until find_files_to_test
|
276
317
|
end
|
277
318
|
|
319
|
+
def files_matching regexp
|
320
|
+
@files.keys.select { |k|
|
321
|
+
k =~ regexp
|
322
|
+
}
|
323
|
+
end
|
324
|
+
|
278
325
|
############################################################
|
279
326
|
# Hooks:
|
280
327
|
|