test-unit 3.0.5 → 3.0.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 82214fb59acb16827aacf60b960cefc080128e3d
4
- data.tar.gz: 2639d42836d7ca114f9acb65e1e6c67136672acc
3
+ metadata.gz: 7a340ad8305720bf34c90d9d88612f087feaec21
4
+ data.tar.gz: fadfe8512c5ee8a5b4e52c296da11abdfdd3569d
5
5
  SHA512:
6
- metadata.gz: 814c6f16fe4e256ad788617cb627441b93ce32c20a3b8972e5e4e799534a8c3350ff77ecdef0bc13ab6fcb5b532b7efec814717f2cfee6fbbabdfd04829f5b4c
7
- data.tar.gz: a6301d7b7e109157505e354dd3c43393921f51b10bbddd5f44e26f1e2689b8c7be9059da74d61be8bfc73fc626ae3f9d601292ccbb1ce9d80f14bb0f21fe5327
6
+ metadata.gz: a1a2ed9f115b3984ec88efc7f0183fff3050708421c5e6e14335f13d612b0d481d988e512132a1a9204d09e586786b972ce20fb05c12b35af6587b2bbce688ec
7
+ data.tar.gz: df04299b2354a4f6e7a75ed42725c8103b2b9b96fc6fa58b1bb388dff1a35e501e9090f5140f74fde3c62dac863b5d093e3d95023e3205da0149fc1a79940fdf
@@ -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
@@ -1,5 +1,5 @@
1
1
  module Test
2
2
  module Unit
3
- VERSION = '3.0.5'
3
+ VERSION = '3.0.6'
4
4
  end
5
5
  end
@@ -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
- expected = fault.location.collect do |backtrace_entry|
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
- [backtrace_entry, target_line_number == line_number]
31
+ break if target_line_number == line_number
30
32
  end
31
- actual = fault.location.collect do |backtrace_entry|
32
- [backtrace_entry, detector.target?(backtrace_entry)]
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
- assert_equal(expected, actual)
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.5
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-08 00:00:00.000000000 Z
12
+ date: 2014-11-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: power_assert