test-unit 3.0.5 → 3.0.6
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.
- checksums.yaml +4 -4
- data/doc/text/news.md +13 -0
- data/lib/test/unit/fault-location-detector.rb +5 -0
- data/lib/test/unit/version.rb +1 -1
- data/test/test-fault-location-detector.rb +43 -5
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7a340ad8305720bf34c90d9d88612f087feaec21
|
4
|
+
data.tar.gz: fadfe8512c5ee8a5b4e52c296da11abdfdd3569d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a1a2ed9f115b3984ec88efc7f0183fff3050708421c5e6e14335f13d612b0d481d988e512132a1a9204d09e586786b972ce20fb05c12b35af6587b2bbce688ec
|
7
|
+
data.tar.gz: df04299b2354a4f6e7a75ed42725c8103b2b9b96fc6fa58b1bb388dff1a35e501e9090f5140f74fde3c62dac863b5d093e3d95023e3205da0149fc1a79940fdf
|
data/doc/text/news.md
CHANGED
@@ -1,5 +1,18 @@
|
|
1
1
|
# News
|
2
2
|
|
3
|
+
## 3.0.6 - 2014-11-09 {#version-3-0-6}
|
4
|
+
|
5
|
+
It's a minor update release.
|
6
|
+
|
7
|
+
### Improvements
|
8
|
+
|
9
|
+
* Improved code snippet location.
|
10
|
+
[GitHub#84][Patch by Yuki Kurihara]
|
11
|
+
|
12
|
+
### Thanks
|
13
|
+
|
14
|
+
* Yuki Kurihara
|
15
|
+
|
3
16
|
## 3.0.5 - 2014-11-08 {#version-3-0-5}
|
4
17
|
|
5
18
|
It's a minor update release.
|
@@ -2,6 +2,8 @@
|
|
2
2
|
#
|
3
3
|
# License: Ruby's
|
4
4
|
|
5
|
+
require "English"
|
6
|
+
|
5
7
|
module Test
|
6
8
|
module Unit
|
7
9
|
class FaultLocationDetector
|
@@ -18,6 +20,9 @@ module Test
|
|
18
20
|
line_number = line_number.to_i
|
19
21
|
if /\Ain `(.+?)'/ =~ context
|
20
22
|
method_name = $1
|
23
|
+
if /\Ablock (?:\(.+?\) )?in / =~ method_name
|
24
|
+
method_name = $POSTMATCH
|
25
|
+
end
|
21
26
|
else
|
22
27
|
method_name = nil
|
23
28
|
end
|
data/lib/test/unit/version.rb
CHANGED
@@ -24,14 +24,21 @@ class TestFaultLocationDetector < Test::Unit::TestCase
|
|
24
24
|
def assert_detect(fault, target_line_number)
|
25
25
|
detector = Test::Unit::FaultLocationDetector.new(fault, @fetcher)
|
26
26
|
|
27
|
-
|
27
|
+
expected_backtrace_entries_until_detected = []
|
28
|
+
fault.location.each do |backtrace_entry|
|
29
|
+
expected_backtrace_entries_until_detected << backtrace_entry
|
28
30
|
_, line_number, = detector.split_backtrace_entry(backtrace_entry)
|
29
|
-
|
31
|
+
break if target_line_number == line_number
|
30
32
|
end
|
31
|
-
|
32
|
-
|
33
|
+
|
34
|
+
actual_backtrace_entries_until_detected = []
|
35
|
+
fault.location.each do |backtrace_entry|
|
36
|
+
actual_backtrace_entries_until_detected << backtrace_entry
|
37
|
+
break if detector.target?(backtrace_entry)
|
33
38
|
end
|
34
|
-
|
39
|
+
|
40
|
+
assert_equal(expected_backtrace_entries_until_detected,
|
41
|
+
actual_backtrace_entries_until_detected)
|
35
42
|
end
|
36
43
|
|
37
44
|
module AlwaysFailAssertion
|
@@ -122,4 +129,35 @@ class TestFaultLocationDetector < Test::Unit::TestCase
|
|
122
129
|
assert_detect(fault, test_case.target_line_number)
|
123
130
|
end
|
124
131
|
end
|
132
|
+
|
133
|
+
class TestInBlock < self
|
134
|
+
def test_in_block
|
135
|
+
test_case = Class.new(Test::Unit::TestCase) do
|
136
|
+
include AlwaysFailAssertion
|
137
|
+
|
138
|
+
class << self
|
139
|
+
def target_line_number
|
140
|
+
@@target_line_number
|
141
|
+
end
|
142
|
+
|
143
|
+
def target_line_number=(line_number)
|
144
|
+
@@target_line_number = line_number
|
145
|
+
end
|
146
|
+
end
|
147
|
+
|
148
|
+
def run_yield
|
149
|
+
yield
|
150
|
+
end
|
151
|
+
|
152
|
+
def test_failed
|
153
|
+
run_yield do
|
154
|
+
self.class.target_line_number = __LINE__; assert_always_failed
|
155
|
+
end
|
156
|
+
end
|
157
|
+
end
|
158
|
+
|
159
|
+
fault = run_test_case(test_case)
|
160
|
+
assert_detect(fault, test_case.target_line_number)
|
161
|
+
end
|
162
|
+
end
|
125
163
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: test-unit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kouhei Sutou
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-11-
|
12
|
+
date: 2014-11-09 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: power_assert
|