ZenTest 4.9.5 → 4.10.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/History.txt +7 -0
- data/README.txt +10 -0
- data/lib/autotest.rb +44 -40
- data/lib/zentest.rb +1 -1
- data/test/test_autotest.rb +17 -11
- metadata +9 -9
- metadata.gz.sig +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8f8a3f08c3eeace59bc81d6b178c29372c716e25
|
4
|
+
data.tar.gz: 8841b0872c66d27eb6e6eb77de3394dc9184a550
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 68b4adc55747a77f47c4adf26b373cda2f98252731926ec50d5f2913107b2cb8dc2281e1960e91f767322bbb0fbf82e2a507cddd87cca0ba9d56f3da09049781
|
7
|
+
data.tar.gz: 01c12142f9ecc9ee9175fdaac1a9848eafd69e3dd9e4a5999ad3cdc25b834dc25c3c89c2a09801c94f1e737d59ba53aba2ec42c343a16e2e3edfa8d4b17ccc5c
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/History.txt
CHANGED
data/README.txt
CHANGED
@@ -96,6 +96,16 @@ Then add the following to the ".autotest" file:
|
|
96
96
|
|
97
97
|
require "autotest/suffix"
|
98
98
|
|
99
|
+
If you prefer minitest/spec to minitest/unit, you can still use autotest
|
100
|
+
by installing the autotest-spec plugin.
|
101
|
+
To do this first install the autotest-spec gem:
|
102
|
+
|
103
|
+
$ gem install autotest-spec
|
104
|
+
|
105
|
+
Then add the following to the ".autotest" file:
|
106
|
+
|
107
|
+
require "autotest/spec"
|
108
|
+
|
99
109
|
== SYNOPSIS
|
100
110
|
|
101
111
|
ZenTest MyProject.rb TestMyProject.rb > missing.rb
|
data/lib/autotest.rb
CHANGED
@@ -1,7 +1,5 @@
|
|
1
|
-
require
|
2
|
-
require
|
3
|
-
|
4
|
-
$TESTING = false unless defined? $TESTING
|
1
|
+
require "find"
|
2
|
+
require "rbconfig"
|
5
3
|
|
6
4
|
##
|
7
5
|
# Autotest continuously scans the files in your project for changes
|
@@ -75,6 +73,7 @@ class Autotest
|
|
75
73
|
end
|
76
74
|
|
77
75
|
HOOKS = Hash.new { |h,k| h[k] = [] }
|
76
|
+
|
78
77
|
unless defined? WINDOZE then
|
79
78
|
WINDOZE = /mswin|mingw/ =~ RbConfig::CONFIG['host_os']
|
80
79
|
SEP = WINDOZE ? '&' : ';'
|
@@ -113,6 +112,7 @@ class Autotest
|
|
113
112
|
end
|
114
113
|
|
115
114
|
opts.on "-d", "--debug", "Debug mode, for reporting bugs." do
|
115
|
+
require "pp"
|
116
116
|
options[:debug] = true
|
117
117
|
end
|
118
118
|
|
@@ -249,26 +249,28 @@ class Autotest
|
|
249
249
|
end
|
250
250
|
|
251
251
|
attr_writer :known_files
|
252
|
-
attr_accessor
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
252
|
+
attr_accessor :completed_re
|
253
|
+
attr_accessor :extra_class_map
|
254
|
+
attr_accessor :extra_files
|
255
|
+
attr_accessor :failed_results_re
|
256
|
+
attr_accessor :files_to_test
|
257
|
+
attr_accessor :find_directories
|
258
|
+
attr_accessor :find_order
|
259
|
+
attr_accessor :interrupted
|
260
|
+
attr_accessor :last_mtime
|
261
|
+
attr_accessor :latest_results
|
262
|
+
attr_accessor :libs
|
263
|
+
attr_accessor :order # TODO: deprecate and remove
|
264
|
+
attr_accessor :output
|
265
|
+
attr_accessor :prefix
|
266
|
+
attr_accessor :results
|
267
|
+
attr_accessor :sleep
|
268
|
+
attr_accessor :tainted
|
269
|
+
attr_accessor :test_mappings
|
270
|
+
attr_accessor :testlib
|
271
|
+
attr_accessor :testprefix
|
272
|
+
attr_accessor :unit_diff
|
273
|
+
attr_accessor :wants_to_quit
|
272
274
|
|
273
275
|
alias tainted? tainted
|
274
276
|
|
@@ -279,8 +281,8 @@ class Autotest
|
|
279
281
|
# these two are set directly because they're wrapped with
|
280
282
|
# add/remove/clear accessor methods
|
281
283
|
@exception_list = []
|
282
|
-
@test_mappings = []
|
283
284
|
@child = nil
|
285
|
+
self.test_mappings = []
|
284
286
|
|
285
287
|
self.completed_re =
|
286
288
|
/\d+ (tests|runs), \d+ assertions, \d+ failures, \d+ errors(, \d+ skips)?/
|
@@ -295,7 +297,9 @@ class Autotest
|
|
295
297
|
self.output = $stderr
|
296
298
|
self.prefix = nil
|
297
299
|
self.sleep = 1
|
298
|
-
self.testlib = "minitest/autorun"
|
300
|
+
self.testlib = "minitest/autorun" # TODO: rename
|
301
|
+
self.testprefix = "gem 'minitest'" # TODO: rename
|
302
|
+
|
299
303
|
specified_directories = ARGV.reject { |arg| arg.start_with?("-") } # options are not directories
|
300
304
|
self.find_directories = specified_directories.empty? ? ['.'] : specified_directories
|
301
305
|
self.unit_diff = nil
|
@@ -303,7 +307,7 @@ class Autotest
|
|
303
307
|
|
304
308
|
# file in /lib -> run test in /test
|
305
309
|
self.add_mapping(/^lib\/.*\.rb$/) do |filename, _|
|
306
|
-
possible = File.basename(filename).gsub '_', '_?'
|
310
|
+
possible = File.basename(filename).gsub '_', '_?'
|
307
311
|
files_matching %r%^test/.*#{possible}$%
|
308
312
|
end
|
309
313
|
|
@@ -321,7 +325,6 @@ class Autotest
|
|
321
325
|
end
|
322
326
|
|
323
327
|
def debug
|
324
|
-
require "pp"
|
325
328
|
find_files_to_test
|
326
329
|
|
327
330
|
puts "Known test files:"
|
@@ -606,7 +609,7 @@ class Autotest
|
|
606
609
|
self.files_to_test = consolidate_failures failed
|
607
610
|
|
608
611
|
color = failed.empty? ? :green : :red
|
609
|
-
hook color
|
612
|
+
hook color
|
610
613
|
else
|
611
614
|
self.latest_results = nil
|
612
615
|
end
|
@@ -624,13 +627,6 @@ class Autotest
|
|
624
627
|
@known_files
|
625
628
|
end
|
626
629
|
|
627
|
-
##
|
628
|
-
# Returns the base of the ruby command.
|
629
|
-
|
630
|
-
def ruby_cmd
|
631
|
-
"#{prefix}#{ruby} -I#{libs} -rubygems"
|
632
|
-
end
|
633
|
-
|
634
630
|
##
|
635
631
|
# Generate the commands to test the supplied files
|
636
632
|
|
@@ -644,6 +640,7 @@ class Autotest
|
|
644
640
|
|
645
641
|
cmds = []
|
646
642
|
full, partial = reorder(files_to_test).partition { |k,v| v.empty? }
|
643
|
+
|
647
644
|
diff = self.unit_diff
|
648
645
|
diff = " | #{diff}" if diff and diff !~ /^\|/
|
649
646
|
|
@@ -651,7 +648,7 @@ class Autotest
|
|
651
648
|
classes = full.map {|k,v| k}.flatten.uniq
|
652
649
|
classes.unshift testlib
|
653
650
|
classes = classes.join " "
|
654
|
-
cmds << "#{ruby_cmd} -e \"%w[#{classes}].each { |f| require f }\"#{diff}"
|
651
|
+
cmds << "#{ruby_cmd} -e \"#{testprefix}; %w[#{classes}].each { |f| require f }\"#{diff}"
|
655
652
|
end
|
656
653
|
|
657
654
|
partial.each do |klass, methods|
|
@@ -722,6 +719,13 @@ class Autotest
|
|
722
719
|
return ruby
|
723
720
|
end
|
724
721
|
|
722
|
+
##
|
723
|
+
# Returns the base of the ruby command.
|
724
|
+
|
725
|
+
def ruby_cmd
|
726
|
+
"#{prefix}#{ruby} -I#{libs} -rubygems"
|
727
|
+
end
|
728
|
+
|
725
729
|
##
|
726
730
|
# Return the name of the file with the tests for filename by finding
|
727
731
|
# a +test_mapping+ that matches the file and executing the mapping's
|
@@ -730,7 +734,7 @@ class Autotest
|
|
730
734
|
def test_files_for filename
|
731
735
|
result = []
|
732
736
|
|
733
|
-
|
737
|
+
self.test_mappings.each do |file_re, proc|
|
734
738
|
if filename =~ file_re then
|
735
739
|
result = [proc.call(filename, $~)].
|
736
740
|
flatten.sort.uniq.select { |f| known_files[f] }
|
@@ -738,10 +742,10 @@ class Autotest
|
|
738
742
|
end
|
739
743
|
end
|
740
744
|
|
741
|
-
|
745
|
+
pp :test_file_for => [filename, result.first] if result and options[:debug]
|
742
746
|
|
743
747
|
output.puts "No tests matched #{filename}" if
|
744
|
-
|
748
|
+
options[:verbose] and result.empty?
|
745
749
|
|
746
750
|
return result
|
747
751
|
end
|
data/lib/zentest.rb
CHANGED
data/test/test_autotest.rb
CHANGED
@@ -1,7 +1,5 @@
|
|
1
1
|
#!/usr/local/bin/ruby -w
|
2
2
|
|
3
|
-
$TESTING = true
|
4
|
-
|
5
3
|
require 'rubygems'
|
6
4
|
require 'minitest/autorun'
|
7
5
|
|
@@ -19,7 +17,7 @@ require 'autotest'
|
|
19
17
|
# run_tests
|
20
18
|
|
21
19
|
class Autotest
|
22
|
-
attr_reader :
|
20
|
+
attr_reader :exception_list
|
23
21
|
|
24
22
|
def self.clear_hooks
|
25
23
|
HOOKS.clear
|
@@ -130,7 +128,7 @@ class TestAutotest < Minitest::Test
|
|
130
128
|
end
|
131
129
|
|
132
130
|
def test_consolidate_failures_multiple_possibilities
|
133
|
-
|
131
|
+
@files[@other_test] = Time.at(42)
|
134
132
|
result = @a.consolidate_failures([['test_unmatched', @test_class]])
|
135
133
|
expected = { @test => ['test_unmatched']}
|
136
134
|
assert_equal expected, result
|
@@ -192,8 +190,12 @@ class TestAutotest < Minitest::Test
|
|
192
190
|
empty = {}
|
193
191
|
|
194
192
|
files = { "fooby.rb" => Time.at(42) }
|
195
|
-
|
196
|
-
|
193
|
+
@a.options[:verbose] = true
|
194
|
+
|
195
|
+
capture_io do
|
196
|
+
assert @a.find_files_to_test(files) # we find fooby,
|
197
|
+
assert_equal empty, @a.files_to_test # but it isn't something to test
|
198
|
+
end
|
197
199
|
assert_equal "No tests matched fooby.rb\n", @a.output.string
|
198
200
|
end
|
199
201
|
|
@@ -425,12 +427,13 @@ test_error2(#{@test_class}):
|
|
425
427
|
req = ".each { |f| require f }\""
|
426
428
|
|
427
429
|
expected =
|
428
|
-
[ "#{pre} -e \"
|
430
|
+
[ "#{pre} -e \"gem 'minitest'",
|
431
|
+
"%w[minitest/autorun #{@test}]#{req}",
|
429
432
|
"#{pre} test/test_fooby.rb -n \"/^(test_something1|test_something2)$/\""
|
430
433
|
].join("; ")
|
431
434
|
|
432
435
|
result = @a.make_test_cmd f
|
433
|
-
assert_equal expected, result
|
436
|
+
assert_equal expected.gsub(/ /, "\n"), result.gsub(/ /, "\n")
|
434
437
|
end
|
435
438
|
|
436
439
|
def test_make_test_cmd_unit_diff
|
@@ -444,7 +447,8 @@ test_error2(#{@test_class}):
|
|
444
447
|
req = ".each { |f| require f }\""
|
445
448
|
post = "| unit_diff -u"
|
446
449
|
|
447
|
-
expected = [ "#{pre} -e \"
|
450
|
+
expected = [ "#{pre} -e \"gem 'minitest'",
|
451
|
+
"%w[minitest/autorun #{@test}]#{req} #{post}",
|
448
452
|
"#{pre} test/test_fooby.rb -n \"/^(test_something1|test_something2)$/\" #{post}" ].join("; ")
|
449
453
|
|
450
454
|
result = @a.make_test_cmd f
|
@@ -515,8 +519,10 @@ test_error2(#{@test_class}):
|
|
515
519
|
t = @a.last_mtime
|
516
520
|
files = { f => t + 1 }
|
517
521
|
|
518
|
-
|
519
|
-
|
522
|
+
capture_io do
|
523
|
+
assert @a.find_files_to_test(files)
|
524
|
+
assert_equal expected, @a.files_to_test
|
525
|
+
end
|
520
526
|
assert_equal t, @a.last_mtime
|
521
527
|
assert_equal "", @a.output.string
|
522
528
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ZenTest
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.
|
4
|
+
version: 4.10.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Davis
|
@@ -30,7 +30,7 @@ cert_chain:
|
|
30
30
|
Y4evBVezr3SjXz08vPqRO5YRdO3zfeMT8gBjRqZjWJGMZ2lD4XNfrs7eky74CyZw
|
31
31
|
xx3n58i0lQkBE1EpKE0lFu/y
|
32
32
|
-----END CERTIFICATE-----
|
33
|
-
date:
|
33
|
+
date: 2014-04-23 00:00:00.000000000 Z
|
34
34
|
dependencies:
|
35
35
|
- !ruby/object:Gem::Dependency
|
36
36
|
name: minitest
|
@@ -38,14 +38,14 @@ dependencies:
|
|
38
38
|
requirements:
|
39
39
|
- - ~>
|
40
40
|
- !ruby/object:Gem::Version
|
41
|
-
version: '5.
|
41
|
+
version: '5.3'
|
42
42
|
type: :development
|
43
43
|
prerelease: false
|
44
44
|
version_requirements: !ruby/object:Gem::Requirement
|
45
45
|
requirements:
|
46
46
|
- - ~>
|
47
47
|
- !ruby/object:Gem::Version
|
48
|
-
version: '5.
|
48
|
+
version: '5.3'
|
49
49
|
- !ruby/object:Gem::Dependency
|
50
50
|
name: rdoc
|
51
51
|
requirement: !ruby/object:Gem::Requirement
|
@@ -66,14 +66,14 @@ dependencies:
|
|
66
66
|
requirements:
|
67
67
|
- - ~>
|
68
68
|
- !ruby/object:Gem::Version
|
69
|
-
version: '3.
|
69
|
+
version: '3.12'
|
70
70
|
type: :development
|
71
71
|
prerelease: false
|
72
72
|
version_requirements: !ruby/object:Gem::Requirement
|
73
73
|
requirements:
|
74
74
|
- - ~>
|
75
75
|
- !ruby/object:Gem::Version
|
76
|
-
version: '3.
|
76
|
+
version: '3.12'
|
77
77
|
description: |-
|
78
78
|
ZenTest provides 4 different tools: zentest, unit_diff, autotest, and
|
79
79
|
multiruby.
|
@@ -115,6 +115,7 @@ extra_rdoc_files:
|
|
115
115
|
- example.txt
|
116
116
|
files:
|
117
117
|
- .autotest
|
118
|
+
- .gemtest
|
118
119
|
- History.txt
|
119
120
|
- Manifest.txt
|
120
121
|
- README.txt
|
@@ -152,7 +153,6 @@ files:
|
|
152
153
|
- test/test_unit_diff.rb
|
153
154
|
- test/test_zentest.rb
|
154
155
|
- test/test_zentest_mapping.rb
|
155
|
-
- .gemtest
|
156
156
|
homepage: https://github.com/seattlerb/zentest
|
157
157
|
licenses:
|
158
158
|
- MIT
|
@@ -177,8 +177,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
177
177
|
- !ruby/object:Gem::Version
|
178
178
|
version: '3.0'
|
179
179
|
requirements: []
|
180
|
-
rubyforge_project:
|
181
|
-
rubygems_version: 2.1
|
180
|
+
rubyforge_project:
|
181
|
+
rubygems_version: 2.2.1
|
182
182
|
signing_key:
|
183
183
|
specification_version: 4
|
184
184
|
summary: 'ZenTest provides 4 different tools: zentest, unit_diff, autotest, and multiruby'
|
metadata.gz.sig
CHANGED
@@ -1 +1,2 @@
|
|
1
|
-
|
1
|
+
l3�\����E^/"3<S�&#m1�+c[IA���e�g�h0�%+
|
2
|
+
�������P�O5�x���ܧ
|