autotest 4.2.3 → 4.2.4
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/README.markdown +9 -4
- data/VERSION +1 -1
- data/autotest.gemspec +4 -2
- data/bin/autotest +3 -0
- data/bin/unit_diff +5 -1
- data/lib/autotest.rb +14 -2
- data/test/test_autotest_integration.rb +83 -0
- metadata +4 -2
data/README.markdown
CHANGED
@@ -5,9 +5,11 @@ This is a fork of the ZenTest package to extract autotest from it.
|
|
5
5
|
Improvements over ZenTest
|
6
6
|
=========================
|
7
7
|
- possibility to not run all tests after a failed test passes
|
8
|
+
- possibility to use alternative config file
|
8
9
|
- simplified test setup
|
9
10
|
- simplified packaging
|
10
11
|
- less globals flying around
|
12
|
+
- integration tests
|
11
13
|
|
12
14
|
Install
|
13
15
|
=======
|
@@ -24,12 +26,14 @@ Usage
|
|
24
26
|
- run autotest
|
25
27
|
|
26
28
|
### Options
|
27
|
-
-f, --fast-start Do not run
|
28
|
-
-c, --no-full-after-failed Do not run
|
29
|
+
-f, --fast-start Do not run full tests at start
|
30
|
+
-c, --no-full-after-failed Do not run full tests after failed test passed
|
29
31
|
-v, --verbose Be verbose. Prints files that autotest doesn't know how to map to tests
|
30
32
|
-q, --quiet Be quiet.
|
33
|
+
-r, --rc Path to config file. (Defaults to ~/.autotest or current_dir/.autotest)
|
31
34
|
-h, --help Show this.
|
32
35
|
|
36
|
+
|
33
37
|
Tips
|
34
38
|
====
|
35
39
|
- you need diff.exe on windows. Try http://gnuwin32.sourceforge.net/packages.html
|
@@ -47,8 +51,9 @@ TODO
|
|
47
51
|
License
|
48
52
|
=======
|
49
53
|
|
50
|
-
###This is a stripped down version of ZenTest
|
51
|
-
|
54
|
+
### This is a stripped down version of ZenTest, stripping done by
|
55
|
+
- [Shane Liebling](http://github.com/shanel)
|
56
|
+
- [Michael Grosser](http://pragmatig.wordpress.com)
|
52
57
|
|
53
58
|
### ZenTest Authors
|
54
59
|
- http://www.zenspider.com/ZSS/Products/ZenTest/
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
4.2.
|
1
|
+
4.2.4
|
data/autotest.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{autotest}
|
8
|
-
s.version = "4.2.
|
8
|
+
s.version = "4.2.4"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Ryan Davis"]
|
12
|
-
s.date = %q{2010-01-
|
12
|
+
s.date = %q{2010-01-31}
|
13
13
|
s.executables = ["unit_diff", "autotest"]
|
14
14
|
s.extra_rdoc_files = [
|
15
15
|
"README.markdown"
|
@@ -35,6 +35,7 @@ Gem::Specification.new do |s|
|
|
35
35
|
"lib/unit_diff.rb",
|
36
36
|
"test/helper.rb",
|
37
37
|
"test/test_autotest.rb",
|
38
|
+
"test/test_autotest_integration.rb",
|
38
39
|
"test/test_unit_diff.rb"
|
39
40
|
]
|
40
41
|
s.homepage = %q{http://github.com/grosser/autotest}
|
@@ -44,6 +45,7 @@ Gem::Specification.new do |s|
|
|
44
45
|
s.summary = %q{Autotest, without ZenTest}
|
45
46
|
s.test_files = [
|
46
47
|
"test/test_autotest.rb",
|
48
|
+
"test/test_autotest_integration.rb",
|
47
49
|
"test/helper.rb",
|
48
50
|
"test/test_unit_diff.rb"
|
49
51
|
]
|
data/bin/autotest
CHANGED
@@ -14,6 +14,9 @@ BANNER
|
|
14
14
|
opts.on("-c", "--no-full-after-failed","Do not run full tests after failed test passed") { options[:no_full_after_failed] = true }
|
15
15
|
opts.on("-v", "--verbose","Be verbose. Prints files that autotest doesn't know how to map to tests") { options[:verbose] = true }
|
16
16
|
opts.on("-q", "--quiet","Be quiet.") { options[:quiet] = true }
|
17
|
+
opts.on("-r", "--rc", String, "Path to config file. (Defaults to ~/.autotest or current_dir/.autotest)") do |opt|
|
18
|
+
options[:rc] = opt
|
19
|
+
end
|
17
20
|
opts.on("-h", "--help","Show this.") { puts opts;exit }
|
18
21
|
end.parse!
|
19
22
|
|
data/bin/unit_diff
CHANGED
@@ -13,7 +13,11 @@
|
|
13
13
|
# -u unified diff
|
14
14
|
# -v display version
|
15
15
|
|
16
|
-
|
16
|
+
begin
|
17
|
+
require 'unit_diff'
|
18
|
+
rescue LoadError
|
19
|
+
require File.dirname(__FILE__) + '/../lib/unit_diff'
|
20
|
+
end
|
17
21
|
|
18
22
|
############################################################
|
19
23
|
|
data/lib/autotest.rb
CHANGED
@@ -157,6 +157,8 @@ class Autotest
|
|
157
157
|
@exception_list = []
|
158
158
|
@test_mappings = []
|
159
159
|
|
160
|
+
ENV['UNIT_DIFF'] ||= 'unit_diff'
|
161
|
+
|
160
162
|
self.completed_re = /\d+ tests, \d+ assertions, \d+ failures, \d+ errors/
|
161
163
|
self.extra_class_map = {}
|
162
164
|
self.extra_files = []
|
@@ -170,7 +172,7 @@ class Autotest
|
|
170
172
|
self.sleep = 1
|
171
173
|
self.testlib = "test/unit"
|
172
174
|
self.find_directories = ['.']
|
173
|
-
self.unit_diff = "
|
175
|
+
self.unit_diff = "#{ENV['UNIT_DIFF']} -u"
|
174
176
|
|
175
177
|
#add Test::Unit mappings
|
176
178
|
#file in /lib -> run test in /test
|
@@ -185,7 +187,17 @@ class Autotest
|
|
185
187
|
end
|
186
188
|
|
187
189
|
#execute custom extensions
|
188
|
-
[
|
190
|
+
load_custom_extensions(options[:rc])
|
191
|
+
end
|
192
|
+
|
193
|
+
def load_custom_extensions(config_file)
|
194
|
+
configs = ['./.autotest']
|
195
|
+
if config_file
|
196
|
+
configs << File.expand_path(config_file)
|
197
|
+
else
|
198
|
+
configs << File.expand_path('~/.autotest')
|
199
|
+
end
|
200
|
+
configs.each do |f|
|
189
201
|
load f if File.exist? f
|
190
202
|
end
|
191
203
|
end
|
@@ -0,0 +1,83 @@
|
|
1
|
+
require 'test/helper'
|
2
|
+
require 'autotest'
|
3
|
+
require 'shoulda'
|
4
|
+
|
5
|
+
class TestAutotestIntegration < Test::Unit::TestCase
|
6
|
+
def temp_dir
|
7
|
+
"#{File.dirname(__FILE__)}/tmp"
|
8
|
+
end
|
9
|
+
|
10
|
+
def autotest_executable
|
11
|
+
'../../bin/autotest'
|
12
|
+
end
|
13
|
+
|
14
|
+
def unit_diff_executable
|
15
|
+
File.expand_path("./#{File.dirname(__FILE__)}/../bin/unit_diff")
|
16
|
+
end
|
17
|
+
|
18
|
+
def run_autotest(flag_string='')
|
19
|
+
`cd #{temp_dir} && #{autotest_executable} #{flag_string}`
|
20
|
+
end
|
21
|
+
|
22
|
+
def write(file, text)
|
23
|
+
file = "#{temp_dir}/#{file}"
|
24
|
+
dir = File.dirname(file)
|
25
|
+
`mkdir -p #{dir}` unless File.directory?(dir)
|
26
|
+
File.open(file, 'w'){|f| f.write text }
|
27
|
+
end
|
28
|
+
|
29
|
+
def write_passing_tests times
|
30
|
+
write('test/test_x.rb', %{ class TestX < Test::Unit::TestCase; #{times}.times{|i| define_method("test_\#{i}"){ assert true }}; end })
|
31
|
+
end
|
32
|
+
|
33
|
+
context 'integration' do
|
34
|
+
context 'green run' do
|
35
|
+
setup do
|
36
|
+
ENV['UNIT_DIFF'] = unit_diff_executable
|
37
|
+
`rm -rf #{temp_dir}`
|
38
|
+
`mkdir #{temp_dir}`
|
39
|
+
write('.autotest', "Autotest.add_hook(:all_good){print 'all_good';exit}")
|
40
|
+
end
|
41
|
+
|
42
|
+
teardown do
|
43
|
+
`rm -rf #{temp_dir}`
|
44
|
+
end
|
45
|
+
|
46
|
+
should 'do nothing when run inside an empty directory' do
|
47
|
+
assert_equal run_autotest, 'all_good'
|
48
|
+
end
|
49
|
+
|
50
|
+
should 'runs all tests' do
|
51
|
+
write('test/test_x.rb', '')
|
52
|
+
assert_match %r{test/test_x.rb}, run_autotest
|
53
|
+
end
|
54
|
+
|
55
|
+
should 'include output from tests' do
|
56
|
+
write('test/test_x.rb', "print 'YES'")
|
57
|
+
assert_match %r{YES}, run_autotest
|
58
|
+
end
|
59
|
+
|
60
|
+
should 'show one dot per passing test' do
|
61
|
+
write_passing_tests 10
|
62
|
+
assert_match %r{[^\.]#{'\.'*10}[^\.]}, run_autotest
|
63
|
+
end
|
64
|
+
|
65
|
+
should 'show test summary' do
|
66
|
+
write_passing_tests 10
|
67
|
+
assert_match /Finished in \d\.\d+ seconds\.\s*10 tests, 10 assertions, 0 failures, 0 errors/m, run_autotest
|
68
|
+
end
|
69
|
+
|
70
|
+
should 'call good hooks in correct order' do
|
71
|
+
write('.autotest', "Autotest::ALL_HOOKS.each{|hook| Autotest.add_hook(hook){print hook;hook == :all_good ? exit : nil }}")
|
72
|
+
write_passing_tests 1
|
73
|
+
assert_match /\n#{%w[ran_command green all_good died]*''}$/m, run_autotest
|
74
|
+
end
|
75
|
+
|
76
|
+
should 'run with alternate config file location' do
|
77
|
+
write('.autotest_alternate', "Autotest.add_hook(:all_good){print 'all_good';exit}")
|
78
|
+
assert_equal run_autotest('-r .autotest_alternate'), 'all_good'
|
79
|
+
end
|
80
|
+
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: autotest
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.2.
|
4
|
+
version: 4.2.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Davis
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2010-01-
|
12
|
+
date: 2010-01-31 00:00:00 +01:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|
@@ -43,6 +43,7 @@ files:
|
|
43
43
|
- lib/unit_diff.rb
|
44
44
|
- test/helper.rb
|
45
45
|
- test/test_autotest.rb
|
46
|
+
- test/test_autotest_integration.rb
|
46
47
|
- test/test_unit_diff.rb
|
47
48
|
has_rdoc: true
|
48
49
|
homepage: http://github.com/grosser/autotest
|
@@ -74,5 +75,6 @@ specification_version: 3
|
|
74
75
|
summary: Autotest, without ZenTest
|
75
76
|
test_files:
|
76
77
|
- test/test_autotest.rb
|
78
|
+
- test/test_autotest_integration.rb
|
77
79
|
- test/helper.rb
|
78
80
|
- test/test_unit_diff.rb
|