autotest 4.4.5 → 4.4.6
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +3 -708
- data/Manifest.txt +4 -0
- data/README.txt +43 -0
- data/Rakefile +10 -60
- metadata +80 -46
- data/.autotest +0 -18
- data/.gitignore +0 -1
- data/Gemfile +0 -7
- data/Gemfile.lock +0 -38
- data/Readme.md +0 -95
- data/VERSION +0 -1
- data/articles/getting_started_with_autotest.html +0 -533
- data/autotest.gemspec +0 -62
- data/bin/autotest +0 -67
- data/bin/unit_diff +0 -44
- data/example_dot_autotest.rb +0 -12
- data/lib/autotest.rb +0 -724
- data/lib/autotest/autoupdate.rb +0 -26
- data/lib/autotest/once.rb +0 -9
- data/lib/autotest/rcov.rb +0 -27
- data/lib/autotest/restart.rb +0 -12
- data/lib/autotest/timestamp.rb +0 -9
- data/lib/unit_diff.rb +0 -274
- data/test/helper.rb +0 -6
- data/test/test_autotest.rb +0 -515
- data/test/test_autotest_integration.rb +0 -95
- data/test/test_unit_diff.rb +0 -335
@@ -1,95 +0,0 @@
|
|
1
|
-
require File.expand_path('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 run_autotest(flag_string='')
|
15
|
-
`cd #{temp_dir} && #{autotest_executable} #{flag_string}`
|
16
|
-
end
|
17
|
-
|
18
|
-
def write(file, text)
|
19
|
-
file = "#{temp_dir}/#{file}"
|
20
|
-
dir = File.dirname(file)
|
21
|
-
`mkdir -p #{dir}` unless File.directory?(dir)
|
22
|
-
File.open(file, 'w'){|f| f.write text }
|
23
|
-
end
|
24
|
-
|
25
|
-
def write_passing_tests times
|
26
|
-
write('test/test_x.rb', %{ class TestX < Test::Unit::TestCase; #{times}.times{|i| define_method("test_\#{i}"){ assert true }}; end })
|
27
|
-
end
|
28
|
-
|
29
|
-
context 'integration' do
|
30
|
-
context 'green run' do
|
31
|
-
setup do
|
32
|
-
`rm -rf #{temp_dir}`
|
33
|
-
`mkdir #{temp_dir}`
|
34
|
-
write('.autotest', "Autotest.add_hook(:all_good){print 'all_good';exit}")
|
35
|
-
end
|
36
|
-
|
37
|
-
teardown do
|
38
|
-
`rm -rf #{temp_dir}`
|
39
|
-
end
|
40
|
-
|
41
|
-
should 'do nothing when run inside an empty directory' do
|
42
|
-
assert_equal run_autotest, 'all_good'
|
43
|
-
end
|
44
|
-
|
45
|
-
should 'runs all tests' do
|
46
|
-
write('test/test_x.rb', '')
|
47
|
-
assert_match %r{test/test_x.rb}, run_autotest
|
48
|
-
end
|
49
|
-
|
50
|
-
should 'include output from tests' do
|
51
|
-
write('test/test_x.rb', "print 'YES'")
|
52
|
-
assert_match %r{YES}, run_autotest
|
53
|
-
end
|
54
|
-
|
55
|
-
should 'show one dot per passing test' do
|
56
|
-
write_passing_tests 10
|
57
|
-
assert_match %r{[^\.]#{'\.'*10}[^\.]}, run_autotest
|
58
|
-
end
|
59
|
-
|
60
|
-
should 'show test summary' do
|
61
|
-
write_passing_tests 10
|
62
|
-
assert_match /Finished in \d\.\d+ seconds\.\s*10 tests, 10 assertions, 0 failures, 0 errors/m, run_autotest
|
63
|
-
end
|
64
|
-
|
65
|
-
should 'call good hooks in correct order' do
|
66
|
-
write('.autotest', "Autotest::ALL_HOOKS.each{|hook| Autotest.add_hook(hook){print hook;hook == :all_good ? exit : nil }}")
|
67
|
-
write_passing_tests 1
|
68
|
-
assert_match /\n#{%w[ran_command green all_good died]*''}$/m, run_autotest
|
69
|
-
end
|
70
|
-
|
71
|
-
should 'run with alternate config file location' do
|
72
|
-
write('.autotest_alternate', "Autotest.add_hook(:all_good){print 'all_good';exit}")
|
73
|
-
assert_equal run_autotest('-r .autotest_alternate'), 'all_good'
|
74
|
-
end
|
75
|
-
|
76
|
-
should 'support files with whitespaces' do
|
77
|
-
write('test/test_a x.rb', "print 'YES'")
|
78
|
-
assert_match %r{YES}, run_autotest
|
79
|
-
end
|
80
|
-
|
81
|
-
should 'use given style' do
|
82
|
-
write('spec/a_spec.rb', "print 'YES'")
|
83
|
-
assert_match %r{YES}, run_autotest('--style rspec2')
|
84
|
-
end
|
85
|
-
|
86
|
-
should 'run in parallel' do
|
87
|
-
write('test/test_a.rb', "require 'test/unit';print 'YES'")
|
88
|
-
write('test/test_b.rb', "require 'test/unit';print 'YEP'")
|
89
|
-
result = run_autotest('--parallel')
|
90
|
-
assert_match %r{YES}, result
|
91
|
-
assert_match %r{YEP}, result
|
92
|
-
end
|
93
|
-
end
|
94
|
-
end
|
95
|
-
end
|
data/test/test_unit_diff.rb
DELETED
@@ -1,335 +0,0 @@
|
|
1
|
-
require File.expand_path('test/helper')
|
2
|
-
require 'unit_diff'
|
3
|
-
|
4
|
-
class TestUnitDiff < Test::Unit::TestCase
|
5
|
-
|
6
|
-
def setup
|
7
|
-
@diff = UnitDiff.new
|
8
|
-
end
|
9
|
-
|
10
|
-
def test_input
|
11
|
-
header = "Loaded suite ./blah\nStarted\nFF\nFinished in 0.035332 seconds.\n\n"
|
12
|
-
input = "#{header} 1) Failure:\ntest_test1(TestBlah) [./blah.rb:25]:\n<\"line1\\nline2\\nline3\\n\"> expected but was\n<\"line4\\nline5\\nline6\\n\">.\n\n 2) Failure:\ntest_test2(TestBlah) [./blah.rb:29]:\n<\"line1\"> expected but was\n<\"line2\\nline3\\n\\n\">.\n\n2 tests, 2 assertions, 2 failures, 0 errors\n"
|
13
|
-
|
14
|
-
# TODO: I think I'd like a separate footer array as well
|
15
|
-
expected = [[[" 1) Failure:\n", "test_test1(TestBlah) [./blah.rb:25]:\n", "<\"line1\\nline2\\nline3\\n\"> expected but was\n", "<\"line4\\nline5\\nline6\\n\">.\n"],
|
16
|
-
[" 2) Failure:\n", "test_test2(TestBlah) [./blah.rb:29]:\n", "<\"line1\"> expected but was\n", "<\"line2\\nline3\\n\\n\">.\n"]],
|
17
|
-
["\n", "2 tests, 2 assertions, 2 failures, 0 errors\n"]]
|
18
|
-
|
19
|
-
util_unit_diff(header, input, expected, :parse_input)
|
20
|
-
end
|
21
|
-
|
22
|
-
def test_input_miniunit
|
23
|
-
header = "Loaded suite -e\nStarted\nF\nFinished in 0.035332 seconds.\n\n"
|
24
|
-
input = "#{header} 1) Failure:
|
25
|
-
test_blah(TestBlah) [./blah.rb:25]:
|
26
|
-
Expected ['a', 'b', 'c'], not ['a', 'c', 'b'].
|
27
|
-
|
28
|
-
1 tests, 1 assertions, 1 failures, 0 errors
|
29
|
-
"
|
30
|
-
|
31
|
-
expected = [[[" 1) Failure:\n",
|
32
|
-
"test_blah(TestBlah) [./blah.rb:25]:\n",
|
33
|
-
"Expected ['a', 'b', 'c'], not ['a', 'c', 'b'].\n"]],
|
34
|
-
["\n", "1 tests, 1 assertions, 1 failures, 0 errors\n"]]
|
35
|
-
|
36
|
-
util_unit_diff(header, input, expected, :parse_input)
|
37
|
-
end
|
38
|
-
|
39
|
-
def test_input_miniunit_multiline
|
40
|
-
header = "Loaded suite -e\nStarted\nF\nFinished in 0.035332 seconds.\n\n"
|
41
|
-
input = "#{header} 1) Failure:
|
42
|
-
test_blah(TestBlah) [./blah.rb:25]:
|
43
|
-
Expected ['a',
|
44
|
-
'b',
|
45
|
-
'c'], not ['a',
|
46
|
-
'c',
|
47
|
-
'b'].
|
48
|
-
|
49
|
-
1 tests, 1 assertions, 1 failures, 0 errors
|
50
|
-
"
|
51
|
-
|
52
|
-
expected = [[[" 1) Failure:\n",
|
53
|
-
"test_blah(TestBlah) [./blah.rb:25]:\n",
|
54
|
-
"Expected ['a',\n 'b',\n 'c'], not ['a',\n 'c',\n 'b'].\n"]],
|
55
|
-
["\n", "1 tests, 1 assertions, 1 failures, 0 errors\n"]]
|
56
|
-
|
57
|
-
util_unit_diff(header, input, expected, :parse_input)
|
58
|
-
end
|
59
|
-
|
60
|
-
def test_input_mspec
|
61
|
-
header = <<-HEADER
|
62
|
-
Started
|
63
|
-
.......F
|
64
|
-
Finished in 0.1 seconds
|
65
|
-
|
66
|
-
HEADER
|
67
|
-
|
68
|
-
failure = <<-FAILURE
|
69
|
-
1)
|
70
|
-
The unless expression should fail FAILED
|
71
|
-
Expected nil to equal "baz":
|
72
|
-
FAILURE
|
73
|
-
|
74
|
-
backtrace = <<-BACKTRACE
|
75
|
-
PositiveExpectation#== at spec/mspec.rb:217
|
76
|
-
main.__script__ {} at spec/language/unless_spec.rb:49
|
77
|
-
Proc#call at kernel/core/proc.rb:127
|
78
|
-
SpecRunner#it at spec/mspec.rb:368
|
79
|
-
main.it at spec/mspec.rb:412
|
80
|
-
main.__script__ {} at spec/language/unless_spec.rb:48
|
81
|
-
Proc#call at kernel/core/proc.rb:127
|
82
|
-
SpecRunner#describe at spec/mspec.rb:378
|
83
|
-
main.describe at spec/mspec.rb:408
|
84
|
-
main.__script__ at spec/language/unless_spec.rb:3
|
85
|
-
CompiledMethod#as_script at kernel/bootstrap/primitives.rb:41
|
86
|
-
main.load at kernel/core/compile.rb:150
|
87
|
-
main.__script__ {} at last_mspec.rb:11
|
88
|
-
Array#each {} at kernel/core/array.rb:545
|
89
|
-
Integer(Fixnum)#times at kernel/core/integer.rb:15
|
90
|
-
Array#each at kernel/core/array.rb:545
|
91
|
-
main.__script__ at last_mspec.rb:16
|
92
|
-
CompiledMethod#as_script at kernel/bootstrap/primitives.rb:41
|
93
|
-
main.load at kernel/core/compile.rb:150
|
94
|
-
main.__script__ at kernel/loader.rb:145
|
95
|
-
BACKTRACE
|
96
|
-
|
97
|
-
footer = "\n8 examples, 1 failures\n"
|
98
|
-
input = header + failure + backtrace + footer
|
99
|
-
|
100
|
-
expected_backtrace = backtrace.split("\n").map {|l| "#{l}\n"}
|
101
|
-
expected = [[["1)\n", "The unless expression should fail FAILED\n",
|
102
|
-
"Expected nil to equal \"baz\":\n",
|
103
|
-
*expected_backtrace]],
|
104
|
-
["\n", "8 examples, 1 failures\n"]]
|
105
|
-
util_unit_diff(header, input, expected, :parse_input)
|
106
|
-
end
|
107
|
-
|
108
|
-
def test_input_mspec_multiline
|
109
|
-
header = <<-HEADER
|
110
|
-
Started
|
111
|
-
.......F
|
112
|
-
Finished in 0.1 seconds
|
113
|
-
|
114
|
-
HEADER
|
115
|
-
|
116
|
-
failure = <<-FAILURE
|
117
|
-
1)
|
118
|
-
Compiler compiles a case without an argument FAILED
|
119
|
-
Expected #<TestGenerator [[:push, :false], [:gif, #<Label 5>], [:push_literal, "foo"], [:string_dup], [:goto, #<Label 19>], [:set_label, #<Label 5>], [:push, :nil], [:gif, #<Label 10>], [:push_literal, "foo"], [:string_dup], [:goto, #<Label 19>], [:set_label, #<Label 10>], [:push, 2], [:push, 1], [:send, :==, 1, false], [:gif, #<Label 17>], [:push_literal, "bar"], [:string_dup], [:goto, #<Label 19>], [:set_label, #<Label 17>], [:push_literal, "baz"], [:string_dup], [:set_label, #<Label 19>]]
|
120
|
-
to equal #<TestGenerator [[:push, false], [:gif, #<Label 5>], [:push, "foo"], [:string_dup], [:goto, #<Label 6>], [:set_label, #<Label 5>], [:push, nil], [:set_label, #<Label 6>], [:pop], [:push, nil], [:gif, #<Label 12>], [:push, "foo"], [:string_dup], [:goto, #<Label 13>], [:set_label, #<Label 12>], [:push, nil], [:set_label, #<Label 13>], [:pop], [:push, 2], [:push, 1], [:send, :==, 1], [:gif, #<Label 21>], [:push, "bar"], [:string_dup], [:goto, #<Label 23>], [:set_label, #<Label 21>], [:push_literal, "baz"], [:string_dup], [:set_label, #<Label 23>], [:sret]]:
|
121
|
-
FAILURE
|
122
|
-
|
123
|
-
backtrace = <<-BACKTRACE
|
124
|
-
PositiveExpectation#== at spec/mspec.rb:216
|
125
|
-
main.gen at ./compiler2/spec/helper.rb:125
|
126
|
-
main.__script__ {} at compiler2/spec/control_spec.rb:448
|
127
|
-
BACKTRACE
|
128
|
-
|
129
|
-
footer = "\n8 examples, 1 failures\n"
|
130
|
-
input = header + failure + backtrace + footer
|
131
|
-
|
132
|
-
expected_backtrace = backtrace.split("\n").map {|l| "#{l}\n"}
|
133
|
-
expected_failure = failure.split("\n").map {|l| "#{l}\n"}
|
134
|
-
expected = [[[*(expected_failure + expected_backtrace)]],
|
135
|
-
["\n", "8 examples, 1 failures\n"]]
|
136
|
-
util_unit_diff(header, input, expected, :parse_input)
|
137
|
-
end
|
138
|
-
|
139
|
-
def test_unit_diff_empty # simulates broken pipe at the least
|
140
|
-
input = ""
|
141
|
-
expected = ""
|
142
|
-
util_unit_diff("", "", "")
|
143
|
-
end
|
144
|
-
|
145
|
-
def test_parse_diff_angles
|
146
|
-
input = [" 1) Failure:\n",
|
147
|
-
"test_test1(TestBlah) [./blah.rb:25]:\n",
|
148
|
-
"<\"<html>\"> expected but was\n",
|
149
|
-
"<\"<body>\">.\n"
|
150
|
-
]
|
151
|
-
|
152
|
-
expected = [[" 1) Failure:\n", "test_test1(TestBlah) [./blah.rb:25]:\n"],
|
153
|
-
["<html>"],
|
154
|
-
["<body>"],
|
155
|
-
[]]
|
156
|
-
|
157
|
-
assert_equal expected, @diff.parse_diff(input)
|
158
|
-
end
|
159
|
-
|
160
|
-
def test_parse_diff_miniunit
|
161
|
-
input = [" 1) Failure:\n",
|
162
|
-
"test_blah(TestBlah) [./blah.rb:25]:\n",
|
163
|
-
"Expected ['a', 'b', 'c'], not ['a', 'c', 'b'].\n"]
|
164
|
-
|
165
|
-
expected = [[" 1) Failure:\n", "test_blah(TestBlah) [./blah.rb:25]:\n"],
|
166
|
-
["['a', 'b', 'c']"],
|
167
|
-
["['a', 'c', 'b']"],
|
168
|
-
[]]
|
169
|
-
|
170
|
-
assert_equal expected, @diff.parse_diff(input)
|
171
|
-
end
|
172
|
-
|
173
|
-
def test_parse_diff_miniunit_multiline
|
174
|
-
input = [" 1) Failure:\n",
|
175
|
-
"test_blah(TestBlah) [./blah.rb:25]:\n",
|
176
|
-
"Expected ['a',\n'b',\n'c'], not ['a',\n'c',\n'b'].\n"]
|
177
|
-
|
178
|
-
expected = [[" 1) Failure:\n", "test_blah(TestBlah) [./blah.rb:25]:\n"],
|
179
|
-
["['a',\n'b',\n'c']"],
|
180
|
-
["['a',\n'c',\n'b']"],
|
181
|
-
[]]
|
182
|
-
|
183
|
-
assert_equal expected, @diff.parse_diff(input)
|
184
|
-
end
|
185
|
-
|
186
|
-
def test_parse_diff1
|
187
|
-
input = [" 1) Failure:\n",
|
188
|
-
"test_test1(TestBlah) [./blah.rb:25]:\n",
|
189
|
-
"<\"line1\\nline2\\nline3\\n\"> expected but was\n",
|
190
|
-
"<\"line4\\nline5\\nline6\\n\">.\n"
|
191
|
-
]
|
192
|
-
|
193
|
-
expected = [[" 1) Failure:\n", "test_test1(TestBlah) [./blah.rb:25]:\n"], ["line1\\nline2\\nline3\\n"], ["line4\\nline5\\nline6\\n"], []]
|
194
|
-
|
195
|
-
assert_equal expected, @diff.parse_diff(input)
|
196
|
-
end
|
197
|
-
|
198
|
-
def test_parse_diff2
|
199
|
-
input = [" 2) Failure:\n",
|
200
|
-
"test_test2(TestBlah) [./blah.rb:29]:\n",
|
201
|
-
"<\"line1\"> expected but was\n",
|
202
|
-
"<\"line2\\nline3\\n\\n\">.\n"
|
203
|
-
]
|
204
|
-
|
205
|
-
expected = [[" 2) Failure:\n",
|
206
|
-
"test_test2(TestBlah) [./blah.rb:29]:\n"],
|
207
|
-
["line1"],
|
208
|
-
["line2\\nline3\\n\\n"],
|
209
|
-
[]
|
210
|
-
]
|
211
|
-
|
212
|
-
assert_equal expected, @diff.parse_diff(input)
|
213
|
-
end
|
214
|
-
|
215
|
-
def test_parse_diff3
|
216
|
-
input = [" 13) Failure:\n",
|
217
|
-
"test_case_stmt(TestRubyToRubyC) [./r2ctestcase.rb:1198]:\n",
|
218
|
-
"Unknown expected data.\n",
|
219
|
-
"<false> is not true.\n"]
|
220
|
-
|
221
|
-
expected = [[" 13) Failure:\n", "test_case_stmt(TestRubyToRubyC) [./r2ctestcase.rb:1198]:\n", "Unknown expected data.\n"], ["<false> is not true.\n"], nil, []]
|
222
|
-
|
223
|
-
assert_equal expected, @diff.parse_diff(input)
|
224
|
-
end
|
225
|
-
|
226
|
-
def test_parse_diff_suspect_equals
|
227
|
-
input = ["1) Failure:\n",
|
228
|
-
"test_util_capture(AssertionsTest) [test/test_zentest_assertions.rb:53]:\n",
|
229
|
-
"<\"out\"> expected but was\n",
|
230
|
-
"<\"out\">.\n"]
|
231
|
-
expected = [["1) Failure:\n",
|
232
|
-
"test_util_capture(AssertionsTest) [test/test_zentest_assertions.rb:53]:\n"],
|
233
|
-
["out"],
|
234
|
-
["out"], []]
|
235
|
-
|
236
|
-
assert_equal expected, @diff.parse_diff(input)
|
237
|
-
end
|
238
|
-
|
239
|
-
def test_parse_diff_NOT_suspect_equals
|
240
|
-
input = ["1) Failure:\n",
|
241
|
-
"test_util_capture(AssertionsTest) [test/test_zentest_assertions.rb:53]:\n",
|
242
|
-
"<\"out\"> expected but was\n",
|
243
|
-
"<\"out\\n\">.\n"]
|
244
|
-
expected = [["1) Failure:\n",
|
245
|
-
"test_util_capture(AssertionsTest) [test/test_zentest_assertions.rb:53]:\n"],
|
246
|
-
["out"],
|
247
|
-
["out\\n"], []]
|
248
|
-
|
249
|
-
assert_equal expected, @diff.parse_diff(input)
|
250
|
-
end
|
251
|
-
|
252
|
-
def test_parse_diff_mspec
|
253
|
-
input = ["1)\n", "The unless expression should fail FAILED\n",
|
254
|
-
"Expected nil to equal \"baz\":\n",
|
255
|
-
" PositiveExpectation#== at spec/mspec.rb:217\n"]
|
256
|
-
|
257
|
-
expected = [["1)\n", "The unless expression should fail FAILED\n"],
|
258
|
-
["nil"],
|
259
|
-
["\"baz\""],
|
260
|
-
[" PositiveExpectation#== at spec/mspec.rb:217"]]
|
261
|
-
|
262
|
-
assert_equal expected, @diff.parse_diff(input)
|
263
|
-
end
|
264
|
-
|
265
|
-
def test_parse_diff_mspec_multiline
|
266
|
-
input = ["1)\n", "The unless expression should fail FAILED\n",
|
267
|
-
"Expected #<TestGenerator [[:push, :true],\n", " [:dup]\n", "]\n",
|
268
|
-
"to equal #<TestGenerator [[:pop],\n", " [:dup]\n", "]:\n",
|
269
|
-
" PositiveExpectation#== at spec/mspec.rb:217\n"]
|
270
|
-
|
271
|
-
expected = [["1)\n", "The unless expression should fail FAILED\n"],
|
272
|
-
["#<TestGenerator [[:push, :true],\n", " [:dup]\n", "]"],
|
273
|
-
["#<TestGenerator [[:pop],\n", " [:dup]\n", "]"],
|
274
|
-
[" PositiveExpectation#== at spec/mspec.rb:217"]]
|
275
|
-
|
276
|
-
assert_equal expected, @diff.parse_diff(input)
|
277
|
-
end
|
278
|
-
|
279
|
-
def test_unit_diff_angles
|
280
|
-
header = "Loaded suite ./blah\nStarted\nF\nFinished in 0.035332 seconds.\n\n"
|
281
|
-
input = "#{header} 1) Failure:\ntest_test1(TestBlah) [./blah.rb:25]:\n<\"<html>\"> expected but was\n<\"<body>\">.\n\n1 tests, 1 assertions, 1 failures, 0 errors\n"
|
282
|
-
expected = "1) Failure:\ntest_test1(TestBlah) [./blah.rb:25]:\n1c1\n< <html>\n---\n> <body>\n\n1 tests, 1 assertions, 1 failures, 0 errors"
|
283
|
-
|
284
|
-
util_unit_diff(header, input, expected)
|
285
|
-
end
|
286
|
-
|
287
|
-
def test_unit_diff1
|
288
|
-
header = "Loaded suite ./blah\nStarted\nF\nFinished in 0.035332 seconds.\n\n"
|
289
|
-
input = "#{header} 1) Failure:\ntest_test1(TestBlah) [./blah.rb:25]:\n<\"line1\\nline2\\nline3\\n\"> expected but was\n<\"line4\\nline5\\nline6\\n\">.\n\n1 tests, 1 assertions, 1 failures, 0 errors\n"
|
290
|
-
expected = "1) Failure:\ntest_test1(TestBlah) [./blah.rb:25]:\n1,3c1,3\n< line1\n< line2\n< line3\n---\n> line4\n> line5\n> line6\n\n1 tests, 1 assertions, 1 failures, 0 errors"
|
291
|
-
|
292
|
-
util_unit_diff(header, input, expected)
|
293
|
-
end
|
294
|
-
|
295
|
-
def test_unit_diff2
|
296
|
-
header = "Loaded suite ./blah\nStarted\nFF\nFinished in 0.035332 seconds.\n\n"
|
297
|
-
input = "#{header} 1) Failure:\ntest_test1(TestBlah) [./blah.rb:25]:\n<\"line1\\nline2\\nline3\\n\"> expected but was\n<\"line4\\nline5\\nline6\\n\">.\n\n 2) Failure:\ntest_test2(TestBlah) [./blah.rb:29]:\n<\"line1\"> expected but was\n<\"line2\\nline3\\n\\n\">.\n\n2 tests, 2 assertions, 2 failures, 0 errors\n"
|
298
|
-
expected = "1) Failure:\ntest_test1(TestBlah) [./blah.rb:25]:\n1,3c1,3\n< line1\n< line2\n< line3\n---\n> line4\n> line5\n> line6\n\n2) Failure:\ntest_test2(TestBlah) [./blah.rb:29]:\n1c1,4\n< line1\n---\n> line2\n> line3\n> \n> \n\n2 tests, 2 assertions, 2 failures, 0 errors"
|
299
|
-
|
300
|
-
util_unit_diff(header, input, expected)
|
301
|
-
end
|
302
|
-
|
303
|
-
def test_unit_diff3
|
304
|
-
header = ""
|
305
|
-
input = " 13) Failure:\ntest_case_stmt(TestRubyToRubyC) [./r2ctestcase.rb:1198]:\nUnknown expected data.\n<false> is not true.\n"
|
306
|
-
expected = "13) Failure:\ntest_case_stmt(TestRubyToRubyC) [./r2ctestcase.rb:1198]:\nUnknown expected data.\n<false> is not true."
|
307
|
-
|
308
|
-
util_unit_diff(header, input, expected)
|
309
|
-
end
|
310
|
-
|
311
|
-
def test_unit_diff_suspect_equals
|
312
|
-
header = "Loaded suite ./blah\nStarted\n.............................................F............................................\nFinished in 0.834671 seconds.\n\n"
|
313
|
-
footer = "90 tests, 241 assertions, 1 failures, 0 errors"
|
314
|
-
input = "#{header} 1) Failure:\ntest_unit_diff_suspect_equals(TestUnitDiff) [./test/test_unit_diff.rb:122]:\n<\"out\"> expected but was\n<\"out\">.\n\n#{footer}"
|
315
|
-
expected = "1) Failure:\ntest_unit_diff_suspect_equals(TestUnitDiff) [./test/test_unit_diff.rb:122]:\n[no difference--suspect ==]\n\n#{footer}"
|
316
|
-
|
317
|
-
util_unit_diff(header, input, expected)
|
318
|
-
end
|
319
|
-
|
320
|
-
def test_unit_diff_NOT_suspect_equals
|
321
|
-
header = "Loaded suite ./blah\nStarted\n.\nFinished in 0.0 seconds.\n\n"
|
322
|
-
input = "#{header} 1) Failure:\ntest_blah(TestBlah)\n<\"out\"> expected but was\n<\"out\\n\">.\n\n1 tests, 1 assertions, 1 failures, 0 errors"
|
323
|
-
expected = "1) Failure:\ntest_blah(TestBlah)\n1a2\n> \n\n1 tests, 1 assertions, 1 failures, 0 errors"
|
324
|
-
|
325
|
-
util_unit_diff(header, input, expected)
|
326
|
-
end
|
327
|
-
|
328
|
-
def util_unit_diff(header, input, expected, msg=:unit_diff)
|
329
|
-
output = StringIO.new("")
|
330
|
-
actual = @diff.send(msg, StringIO.new(input), output)
|
331
|
-
assert_equal header, output.string, "header output"
|
332
|
-
assert_equal expected, actual
|
333
|
-
end
|
334
|
-
end
|
335
|
-
|