ZenTest 3.6.1 → 3.7.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,30 @@
1
+ === 3.7.0 / 2007-12-21
2
+
3
+ * 8 minor enhancements:
4
+
5
+ * Added add_mapping to make file mappings cleaner.
6
+ * Added assert_callback thanks to Aaron Patterson.
7
+ * Added autotest/cctray.
8
+ * Added extra_files and extra_class_map, allowing .autotest files to be awesome.
9
+ * Added url for lettuce principal thanks to Hugh Sasse.
10
+ * Added zentest.rb refactorings thanks to Hugh Sasse.
11
+ * Exceptions are now an array of regexps, built after :initialize hook.
12
+ * Removed ruby_fork and ruby_fork_client. Eric got a faster laptop. :P
13
+
14
+ * 6 bug fixes:
15
+
16
+ * Fixed all my annoyances with @exceptions.
17
+ * Fixed crasher in autotest/redgreen for non-matches.
18
+ * Fixed everything to work with ruby 1.9.
19
+ * Fixed rubygem requires causing strangeness in tests.
20
+ * Fixed zentest mapping so ruby2ruby and test_ruby2ruby work.
21
+ * Removed stupid YAML methods from TrueClass during
22
+ testing. (Infected by Test::Rails' use of rubygems)
23
+
1
24
  === 3.6.1 / 2007-07-23
2
25
 
3
26
  * 4 minor enhancements:
27
+
4
28
  * Test::Rails::ViewTestCase now uses assert_select.
5
29
  * assert_form and friends now work with blocks like assert_select
6
30
  does.
@@ -12,15 +36,20 @@
12
36
  === 3.6.0 / 2007-05-25
13
37
 
14
38
  * 4 major enhancements:
39
+
15
40
  * New auto-discovery mechanism to make rspec and friends work independently!
16
41
  * Moved and restructured camping and rails as plugins.
17
42
  * Removed rspec - now packaged with rspec and/or as plugin.
18
43
  * Changed the way FTM tests are named. Allows multiple matricies.
44
+
19
45
  * 3 minor enhancements:
46
+
20
47
  * Added :OK special result value to FTM.
21
48
  * Hugh Sasse is awesome. Rdoc happiness.
22
49
  * Parameterized emacs client command.
50
+
23
51
  * 3 bug fixes:
52
+
24
53
  * Dup load path because I'm dum.
25
54
  * Fixed a lame syntax error in emacs.rb.
26
55
  * autotest now builds command separator with '&' on windoze. ARGH! Why is this the first I've heard of this?!?
@@ -28,6 +57,7 @@
28
57
  === 3.5.2 / 2007-04-30
29
58
 
30
59
  * 4 bug fixes:
60
+
31
61
  * Patch up Rails fixture defaults for Test::Rails::TestCase.
32
62
  * Session now properly hooked up to controllers.
33
63
  * ruby 1.8.6 has a bug on 'raise Interrupt' with no args. Fixed on both sides.
@@ -36,6 +66,7 @@
36
66
  === 3.5.1 / 2007-04-17
37
67
 
38
68
  * 4 bug fixes:
69
+
39
70
  * Fixed gem name to be camel-case again. Fixed on rubyforge too.
40
71
  * Fixed rdoc for hooks.
41
72
  * Fixed redgreen, results changed to an array.
@@ -44,11 +75,14 @@
44
75
  === 3.5.0 / 2007-04-12
45
76
 
46
77
  * 4 major enhancements:
78
+
47
79
  * Now requires RubyGems 0.9.1 or newer.
48
80
  * Autotest and unit_diff are both unbuffered. Results are more live.
49
81
  * Refactored and redesigned how files map to test from Sean Carley. See fixtures plugin as an example.
50
82
  * Generalize how autotest handler is instantiated and invoked, allowing for many more autotest types, including combos.
83
+
51
84
  * 23 minor enhancements:
85
+
52
86
  * Added all_good hook if initial run was all_good as well.
53
87
  * Added assert_in_epsilon to ZentestAssertions.
54
88
  * Added autotest plugin to auto-update source ala tinderbox/cruisecontrol.
@@ -72,24 +106,32 @@
72
106
  * Improved autotest/growl.rb output from imajes.
73
107
  * Improved autotest/timestamp output from Josh Susser.
74
108
  * Test::Rails works with Rails 1.2.
109
+
75
110
  * 2 bug fixes:
111
+
76
112
  * Accelerated Test::Rails unit tests via sensible defaults.
77
113
  * Better assertion messages for ZentestAssertions.
78
114
 
79
115
  === 3.4.3 / 2006-12-19
80
116
 
81
117
  * 2 minor enhancements:
118
+
82
119
  * Add assert_title and assert_h (for header).
120
+
83
121
  * 2 bug fixes:
122
+
84
123
  * Rereleased against latest version of hoe to fix load path problems.
85
124
  * Fix case ViewTestCase for case-sensitive file systems.
86
125
 
87
126
  === 3.4.2 / 2006-11-09
88
127
 
89
128
  * 2 minor enhancements:
129
+
90
130
  * Add TextHelper for pluralize.
91
131
  * Add deny_nil to Test::Rails.
132
+
92
133
  * 7 bug fixes:
134
+
93
135
  * Fixed test_help's Flash. It's is a module. Oops...
94
136
  * Don't run util_audit_assert_assigned if tests didn't pass, results will be bogus.
95
137
  * Fixed AssertionsTest names to match what autotest expects.
@@ -101,10 +143,13 @@
101
143
  === 3.4.1 / 2006-10-13
102
144
 
103
145
  * 3 minor enhancements:
146
+
104
147
  * FUNDAMENTALLY changed the way failures map back to tests. This REQUIRES users of autotest to ensure that their tests and impls map 1:1 at every scoping level. I'll blog more details.
105
148
  * Hoe'd rakefile
106
149
  * Added support for render :collection to RenderTree.
150
+
107
151
  * 7 bug fixes:
152
+
108
153
  * Fixed autotest tests for custom ruby names.
109
154
  * Fixed some documentation errors in ControllerTestCase.
110
155
  * Fixed setup in FunctionalTestCase.
@@ -116,6 +161,7 @@
116
161
  === 3.4.0 / 2006-09-12
117
162
 
118
163
  * 13 minor enhancements:
164
+
119
165
  * Broke out example_dot_autotest into multiple files in lib.
120
166
  * Enhanced hook system so it can return true if event handled.
121
167
  * Sleep is now 1 second by default because life is too short.
@@ -129,7 +175,9 @@
129
175
  * Added markaby support for Test::Rails.
130
176
  * Added hack to display a tree of render calls.
131
177
  * Added hook to perform extra setup for
178
+
132
179
  * 5 bug fixes:
180
+
133
181
  - Extended zentest to deal with rails a bit better... ugh.
134
182
  - Fixed @libs for windoze.
135
183
  - Fixed inner class/test identification in autotest.
@@ -139,15 +187,20 @@
139
187
  === 3.3.0 / 2006-07-28
140
188
 
141
189
  * 1 major enhancement:
190
+
142
191
  * autotest has been rewritten to be much cleaner, now has a plugin system.
192
+
143
193
  * 5 minor enhancements:
194
+
144
195
  * test/rails adds helper tests, "stolen" from Geoff's work, (which was "stolen" from ryan's work. :P)
145
196
  * autotest turnaround is now faster.
146
197
  * Added more prune dirs to autotest.
147
198
  * test/rails rewinds IOs containing captured output. Added assert_empty.
148
199
  * Document that autotest doesn't run the db:test:prepare rake task when in Rails mode.
149
200
  * Added ruby_fork, but haven't fully plugged into autotest yet.
201
+
150
202
  * 7 bug fixes:
203
+
151
204
  * Add SIGINT handler to unit_diff to give a more graceful exit.
152
205
  * Don't strip <> from tempfiles, parse_diff does it for us.
153
206
  * Fixed autotest problems on windoze. Ugh.
@@ -160,10 +213,15 @@
160
213
  === 3.2.0 / 2006-04-10
161
214
 
162
215
  * 1 major enhancement:
216
+
163
217
  * Added Test::Rails.
218
+
164
219
  * 1 minor enhancement:
220
+
165
221
  * Extended autotest for Test::Rails.
222
+
166
223
  * 4 bug fixes:
224
+
167
225
  * Autotest now detects changes in rhtml.
168
226
  * Improved autotest's file mapping and choice of ruby.
169
227
  * We've got RDoc, yes we do!
@@ -172,9 +230,12 @@
172
230
  === 3.1.0 / 2006-03-29
173
231
 
174
232
  * 2 major enhancements:
233
+
175
234
  * Added multiruby! YAY!
176
235
  * Massive improvements to autotest: speed, reliability, reporting, etc.
236
+
177
237
  * 10 minor enhancements:
238
+
178
239
  * multiruby builds in a centralized location. YAY!
179
240
  * multiruby now allows reinstalls quickly and easily (can even skip config).
180
241
  * multiruby exits with total sum of exit codes.
@@ -185,7 +246,9 @@
185
246
  * autotest always runs with unit_diff -u.
186
247
  * autotest can now run cvs/svn/p4 up periodically to be a mini-tinderbox.
187
248
  * autotest now has real help.
249
+
188
250
  * 4 bug fixes:
251
+
189
252
  * ZenTest is now zentest. Yay for consistency! (do a rake uninstall to clean)
190
253
  * ZenTest excludes pretty_print methods.
191
254
  * Fixed unary operator issues (they were backwards... oops!) for ZenTest.
@@ -194,13 +257,18 @@
194
257
  === 3.0.0 / 2006-03-06
195
258
 
196
259
  * 2 major enhancements:
260
+
197
261
  * Added autotest and rails_autotest. YAY for continous testing!
198
262
  * Repackaged and gemified. YAY for gemification!
263
+
199
264
  * 3 minor enhancements:
265
+
200
266
  * Added non-mappable tests starting with test_integration_.
201
267
  * Lots of code and test refactoring and cleanup.
202
268
  * Massive improvement on unit tests.
269
+
203
270
  * 3 bug fixes:
271
+
204
272
  * Cleaned up class method inheritence. Esp relevant for rails testing.
205
273
  * Finally fixed the unit_diff parse bug!
206
274
  * Fixed improper counting of errors if a class was missing, should be 1 + missing methods.
@@ -208,10 +276,13 @@
208
276
  === 2.4.0 / 2005-03-21
209
277
 
210
278
  * 3 minor enhancements:
279
+
211
280
  * Able to audit standard class library (so now we can audit rubicon!).
212
281
  * Able to map against class methods (self.blah <=> test_class_blah).
213
282
  * Added -I=rubypath support
283
+
214
284
  * 4 bug fixes:
285
+
215
286
  * bug:1151 Fixed stupid problem w/ unit_diff.
216
287
  * bug:1454 code generation correctly matches class/module for nested classes.
217
288
  * bug:1455 Updated method mapping to work on all operators listed in my quickref.
@@ -220,13 +291,16 @@
220
291
  === 2.3.0 / 2004-11-18
221
292
 
222
293
  * 6 minor enhancements:
294
+
223
295
  * Massively expanded the method name mappings.
224
296
  * Added -r flag to reverse map names, for Rails style testing.
225
297
  * Added -e to auto eval tests generated.
226
298
  * Added -b & -c flags in unit_diff (passed to diff)
227
299
  * Added install and uninstall rules to Makefile.
228
300
  * Added some more doco to README.txt
301
+
229
302
  * 7 bug fixes:
303
+
230
304
  * Cleaned up and refactored tests.
231
305
  * Changed the way files are generated, to accomodate new flags.
232
306
  * Added some more tests.
@@ -238,11 +312,14 @@
238
312
  === 2.2.0 / 2004-10-18
239
313
 
240
314
  * 4 minor enhancements:
315
+
241
316
  * Added LinuxJournalArticle.txt! WOOT!
242
317
  * Added unit_diff.rb - a very cool filter for test output!
243
318
  * Extended ZenTest to work with standard input
244
319
  * Added "ZenTest FULL" to force ZenTest to analyze inherited methods, for subclasses of the standard library.
320
+
245
321
  * 3 bug fixes:
322
+
246
323
  * Extended makefile to be more dynamic and stop diffing versions. ugh.
247
324
  * Expanded the method rename map to handle <<, *, +, and ==.
248
325
  * Added more test cases.
@@ -250,6 +327,7 @@
250
327
  === 2.1.2 / 2004-03-08
251
328
 
252
329
  * 4 bug fixes:
330
+
253
331
  * Fixed yet another 1.8ism, results will be the same in 1.8 and 1.6.
254
332
  * Fixed code responsible for method name conversion.
255
333
  * I am a moron... didn't run tests after updating version.
@@ -258,6 +336,7 @@
258
336
  === 2.1.1 / 2004-03-06
259
337
 
260
338
  * 3 bug fixes:
339
+
261
340
  * Fixed a 1.8ism.
262
341
  * Removed zentestrunner. Older ruby users will just have to suffer.
263
342
  * Updated history to ZenWeb format.
@@ -265,13 +344,18 @@
265
344
  === 2.1.0 / 2003-01-07
266
345
 
267
346
  * 3 major enhancements:
347
+
268
348
  * Output is runnable as-is thanks to zentestrunner.rb.
269
349
  * Wrapped up all running functionality into ZenTest.fix
270
350
  * Added simple statistic output... Thanks Dave & Andy!!!
351
+
271
352
  * 2 minor enhancements:
353
+
272
354
  * Added zentestrunner.rb until Nathaniel accepts my changes!
273
355
  * Added a clean rule to Makefile
356
+
274
357
  * 3 bug fixes:
358
+
275
359
  * Removed at_exit override and avoided test/unit altogether.
276
360
  * Extended README.txt to include some of the rules.
277
361
  * Fixed several tests and added assertions for new stats
@@ -279,14 +363,18 @@
279
363
  === 2.0.0 / 2002-10-29
280
364
 
281
365
  * 2 major enhancements:
366
+
282
367
  * Rewrite of ZenTest.rb into actual OO design.
283
368
  * Added unit tests, finally...
284
369
 
285
370
  === 1.0.1 / 2002-09-28
286
371
 
287
372
  * 1 minor enhancement:
373
+
288
374
  * Only loads when a class is detected, allows some scripts to be skipped.
375
+
289
376
  * 3 bug fixes:
377
+
290
378
  * Cleaned up output. Verbose when $DEBUG is true.
291
379
  * Added an error count that is output at end.
292
380
  * Better filtering or conversion on some method names.
@@ -294,4 +382,5 @@
294
382
  === 1.0.0 / 2002-09-24
295
383
 
296
384
  * 1 major enhancement:
385
+
297
386
  * Birthday!
@@ -6,8 +6,6 @@ Rakefile
6
6
  bin/autotest
7
7
  bin/multiruby
8
8
  bin/rails_test_audit
9
- bin/ruby_fork
10
- bin/ruby_fork_client
11
9
  bin/unit_diff
12
10
  bin/zentest
13
11
  example.txt
@@ -17,6 +15,7 @@ example_dot_autotest.rb
17
15
  lib/autotest.rb
18
16
  lib/autotest/autoupdate.rb
19
17
  lib/autotest/camping.rb
18
+ lib/autotest/cctray.rb
20
19
  lib/autotest/discover.rb
21
20
  lib/autotest/emacs.rb
22
21
  lib/autotest/fixtures.rb
@@ -35,7 +34,6 @@ lib/autotest/shame.rb
35
34
  lib/autotest/snarl.rb
36
35
  lib/autotest/timestamp.rb
37
36
  lib/functional_test_matrix.rb
38
- lib/ruby_fork.rb
39
37
  lib/test/rails.rb
40
38
  lib/test/rails/controller_test_case.rb
41
39
  lib/test/rails/functional_test_case.rb
@@ -56,7 +54,6 @@ test/test_rails_autotest.rb
56
54
  test/test_rails_controller_test_case.rb
57
55
  test/test_rails_helper_test_case.rb
58
56
  test/test_rails_view_test_case.rb
59
- test/test_ruby_fork.rb
60
57
  test/test_unit_diff.rb
61
58
  test/test_zentest.rb
62
59
  test/test_zentest_assertions.rb
data/Rakefile CHANGED
@@ -9,7 +9,7 @@ require './lib/zentest.rb'
9
9
  Hoe.new("ZenTest", ZenTest::VERSION) do |p|
10
10
  p.author = ['Ryan Davis', 'Eric Hodel']
11
11
 
12
- changes = p.paragraphs_of("History.txt", 0..1).join("\n\n")
12
+ changes = p.paragraphs_of("History.txt", 0..4).join("\n\n")
13
13
  urls, summary, *description = p.paragraphs_of("README.txt", 1, 3, 3..8)
14
14
 
15
15
  p.url = urls.gsub(/^\* /, '').split(/\n/)
@@ -4,7 +4,8 @@
4
4
  What do we do to get people writing tests?
5
5
  What do we do to get people writing tests first?
6
6
 
7
- I didn't know it's name, but apparently it's the Lettuce Principal.
7
+ I didn't know it's name, but apparently it's the Lettuce Principal,
8
+ (see http://blog.toolshed.com/2003/03/the_lettuce_pri.html).
8
9
 
9
10
  We NEED to make testing as easy as possible to get them testing.
10
11
 
@@ -124,6 +124,8 @@ class Autotest
124
124
  end
125
125
 
126
126
  attr_accessor(:exceptions,
127
+ :extra_class_map,
128
+ :extra_files,
127
129
  :files,
128
130
  :files_to_test,
129
131
  :interrupted,
@@ -137,9 +139,11 @@ class Autotest
137
139
  :wants_to_quit)
138
140
 
139
141
  def initialize
142
+ @exceptions = []
143
+ @extra_class_map = {}
144
+ @extra_files = []
140
145
  @files = Hash.new Time.at(0)
141
146
  @files_to_test = Hash.new { |h,k| h[k] = [] }
142
- @exceptions = false
143
147
  @libs = %w[. lib test].join(File::PATH_SEPARATOR)
144
148
  @output = $stderr
145
149
  @sleep = 1
@@ -155,6 +159,12 @@ class Autotest
155
159
  }
156
160
 
157
161
  hook :initialize
162
+
163
+ if @exceptions.empty? then
164
+ @exceptions = nil
165
+ else
166
+ @exceptions = Regexp.union(*@exceptions)
167
+ end
158
168
  end
159
169
 
160
170
  # Repeatedly run failed tests, then all tests, then
@@ -195,10 +205,11 @@ class Autotest
195
205
  # Look for files to test then run the tests and
196
206
  # handle the results.
197
207
  def run_tests
208
+ hook :run_command
209
+
198
210
  find_files_to_test # failed + changed/affected
199
211
  cmd = make_test_cmd @files_to_test
200
212
 
201
- hook :run_command
202
213
  puts cmd
203
214
 
204
215
  old_sync = $stdout.sync
@@ -212,7 +223,11 @@ class Autotest
212
223
  putc c
213
224
  line << c
214
225
  if c == ?\n then
215
- @results << line.pack("c*")
226
+ @results << if RUBY_VERSION >= "1.9" then
227
+ line.join
228
+ else
229
+ line.pack "c*"
230
+ end
216
231
  line.clear
217
232
  end
218
233
  end
@@ -229,6 +244,10 @@ class Autotest
229
244
  ############################################################
230
245
  # Utility Methods, not essential to reading of logic
231
246
 
247
+ def add_mapping(regexp, &proc)
248
+ self.test_mappings[regexp] = proc
249
+ end
250
+
232
251
  def add_sigint_handler
233
252
  trap 'INT' do
234
253
  if @interrupted then
@@ -257,7 +276,7 @@ class Autotest
257
276
  def path_to_classname(s)
258
277
  sep = File::SEPARATOR
259
278
  f = s.sub(/^test#{sep}/, '').sub(/\.rb$/, '').split(sep)
260
- f = f.map { |path| path.split(/_/).map { |seg| seg.capitalize }.join }
279
+ f = f.map { |path| path.split(/_|(\d+)/).map { |seg| seg.capitalize }.join }
261
280
  f = f.map { |path| path =~ /^Test/ ? path : "Test#{path}" }
262
281
  f.join('::')
263
282
  end
@@ -267,6 +286,7 @@ class Autotest
267
286
  filters = Hash.new { |h,k| h[k] = [] }
268
287
 
269
288
  class_map = Hash[*@files.keys.grep(/^test/).map { |f| [path_to_classname(f), f] }.flatten]
289
+ class_map.merge!(self.extra_class_map)
270
290
 
271
291
  failed.each do |method, klass|
272
292
  if class_map.has_key? klass then
@@ -284,8 +304,9 @@ class Autotest
284
304
  # a Hash mapping filename to modification time.
285
305
  def find_files
286
306
  result = {}
287
- Find.find '.' do |f|
288
- Find.prune if @exceptions and f =~ @exceptions and test ?d, f
307
+ targets = ['.'] + self.extra_files
308
+ Find.find(*targets) do |f|
309
+ Find.prune if @exceptions and f =~ @exceptions
289
310
 
290
311
  next if test ?d, f
291
312
  next if f =~ /(swp|~|rej|orig)$/ # temporary/patch files