power_assert 0.4.1 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,3 @@
1
1
  module PowerAssert
2
- VERSION = "0.4.1"
2
+ VERSION = "1.0.0"
3
3
  end
data/power_assert.gemspec CHANGED
@@ -1,4 +1,6 @@
1
- $:.push File.expand_path('../lib', __FILE__)
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
2
4
  require 'power_assert/version'
3
5
 
4
6
  Gem::Specification.new do |s|
@@ -10,13 +12,18 @@ Gem::Specification.new do |s|
10
12
  s.summary = %q{Power Assert for Ruby}
11
13
  s.description = %q{Power Assert for Ruby. Power Assert shows each value of variables and method calls in the expression. It is useful for testing, providing which value wasn't correct when the condition is not satisfied.}
12
14
 
13
- s.files = `git ls-files`.split("\n")
14
- s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
15
- s.executables = `git ls-files -- bin/*`.split("\n").map{|f| File.basename(f) }
16
- s.require_paths = ['lib']
15
+ s.files = `git ls-files -z`.split("\x0").reject do |f|
16
+ f.match(%r{^(test|spec|features|benchmarks)/})
17
+ end
18
+ s.bindir = 'exe'
19
+ s.executables = s.files.grep(%r{^exe/}) { |f| File.basename(f) }
20
+ s.require_paths = ['lib']
17
21
  s.add_development_dependency 'test-unit'
18
22
  s.add_development_dependency 'rake'
19
23
  s.add_development_dependency 'simplecov'
24
+ s.add_development_dependency 'bundler'
25
+ s.add_development_dependency 'pry'
26
+ s.add_development_dependency 'byebug'
20
27
  s.extra_rdoc_files = ['README.rdoc']
21
28
  s.rdoc_options = ['--main', 'README.rdoc']
22
29
  s.licenses = ['2-clause BSDL', "Ruby's"]
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: power_assert
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kazuki Tsujimoto
8
8
  autorequire:
9
- bindir: bin
9
+ bindir: exe
10
10
  cert_chain: []
11
- date: 2016-11-27 00:00:00.000000000 Z
11
+ date: 2017-01-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: test-unit
@@ -52,6 +52,48 @@ dependencies:
52
52
  - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: bundler
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: pry
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: byebug
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
55
97
  description: Power Assert for Ruby. Power Assert shows each value of variables and
56
98
  method calls in the expression. It is useful for testing, providing which value
57
99
  wasn't correct when the condition is not satisfied.
@@ -70,15 +112,17 @@ files:
70
112
  - LEGAL
71
113
  - README.rdoc
72
114
  - Rakefile
73
- - benchmarks/bm_yhpg.rb
74
- - benchmarks/helper.rb
115
+ - bin/console
116
+ - bin/setup
75
117
  - lib/power_assert.rb
118
+ - lib/power_assert/colorize.rb
76
119
  - lib/power_assert/configuration.rb
120
+ - lib/power_assert/context.rb
77
121
  - lib/power_assert/enable_tracepoint_events.rb
122
+ - lib/power_assert/inspector.rb
123
+ - lib/power_assert/parser.rb
78
124
  - lib/power_assert/version.rb
79
125
  - power_assert.gemspec
80
- - test/helper.rb
81
- - test/test_power_assert.rb
82
126
  homepage: https://github.com/k-tsj/power_assert
83
127
  licenses:
84
128
  - 2-clause BSDL
@@ -102,7 +146,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
102
146
  version: '0'
103
147
  requirements: []
104
148
  rubyforge_project:
105
- rubygems_version: 2.6.4
149
+ rubygems_version: 2.6.8
106
150
  signing_key:
107
151
  specification_version: 4
108
152
  summary: Power Assert for Ruby
@@ -1,59 +0,0 @@
1
- # Yhpg
2
- # https://gist.github.com/yancya/37d79e02a91afcfdeed1
3
- #
4
- # Author: yancya
5
-
6
- require_relative 'helper'
7
-
8
- class Yhpg
9
- MAPPING = [*'0'..'9', *'A'..'Z', *'a'..'z']
10
-
11
- def initialize(data)
12
- @n, @list = data.split(":").tap { |n, list| break [n.to_i, list.split(",").map { |str| Yhpg.decode(str) }] }
13
- x_nominee = @list.map { |x, _| x }.map { |x| [x, x + 1] }.flatten.tap { |a| a.push(*[0, 62])}.uniq
14
- y_nominee = @list.map { |_, y| y }.map { |y| [y, y + 1] }.flatten.tap { |a| a.push(*[0, 62])}.uniq
15
- x_range_patterns = x_nominee.combination(2).map { |a| (a.min..a.max) }
16
- y_range_patterns = y_nominee.combination(2).map { |a| (a.min..a.max) }
17
- squares = x_range_patterns.product(y_range_patterns)
18
- targets = squares.select { |xrange, yrange| @list.select { |p| check(xrange, yrange, p) }.size == @n }
19
- @areas = targets.map { |x, y| [(x.max - x.min) * (y.max - y.min), x, y] }
20
- end
21
-
22
- def debug
23
- p [@areas.min_by(&:first), @areas.max_by(&:first)]
24
- end
25
-
26
- def Yhpg.decode(str)
27
- str.chars.map { |w| MAPPING.index(w) }
28
- end
29
-
30
- def check(xrange, yrange, target)
31
- x, y = target
32
- (xrange.include?(x) && xrange.include?(x + 1)) &&
33
- (yrange.include?(y) && yrange.include?(y + 1))
34
- end
35
-
36
- def output
37
- case res = [@areas.map(&:first).min, @areas.map(&:first).max].join(',')
38
- when ','
39
- '-'
40
- else
41
- res
42
- end
43
- end
44
- end
45
-
46
- [
47
- ["4:00,11,zz,yy,1y,y1", "3600,3721"], # /*05*/
48
- ].each do |(actual, expect)|
49
- Benchmark.bm(30) do |x|
50
- x.report("expr") { Yhpg.new(actual).output == expect }
51
- x.report("TracePoint.trace { expr }") { TracePoint.new(:return, :c_return) {}.enable { Yhpg.new(actual).output == expect } }
52
- x.report("assertion_message { expr }") {
53
- assertion_message { Yhpg.new(actual).output == expect }
54
- }
55
- x.report("assertion_message { !expr }") {
56
- assertion_message { not Yhpg.new(actual).output == expect }
57
- }
58
- end
59
- end
data/benchmarks/helper.rb DELETED
@@ -1,8 +0,0 @@
1
- require 'benchmark'
2
- require 'power_assert'
3
-
4
- def assertion_message(source = nil, source_binding = TOPLEVEL_BINDING, &blk)
5
- ::PowerAssert.start(source || blk, assertion_method: __callee__, source_binding: source_binding) do |pa|
6
- pa.message unless pa.yield
7
- end
8
- end
data/test/helper.rb DELETED
@@ -1,10 +0,0 @@
1
- begin
2
- if ENV['COVERAGE']
3
- require 'simplecov'
4
- SimpleCov.start do
5
- add_filter '/test/'
6
- add_filter '/vendor/'
7
- end
8
- end
9
- rescue LoadError
10
- end
@@ -1,514 +0,0 @@
1
- require 'test/unit'
2
- require 'power_assert'
3
- require 'ripper'
4
- require 'set'
5
-
6
- class TestPowerAssert < Test::Unit::TestCase
7
- class << self
8
- def t(msg='', &blk)
9
- loc = caller_locations(1, 1)[0]
10
- test("#{loc.path} --location #{loc.lineno} #{msg}", &blk)
11
- end
12
- end
13
-
14
- EXTRACT_METHODS_TEST = [
15
- [[[:method, "c", 4], [:method, "b", 2], [:method, "d", 8], [:method, "a", 0]],
16
- 'a(b(c), d)'],
17
-
18
- [[[:method, "a", 0], [:method, "b", 2], [:method, "d", 6], [:method, "c", 4]],
19
- 'a.b.c(d)'],
20
-
21
- [[[:method, "b", 2], [:method, "a", 0], [:method, "c", 5], [:method, "e", 9], [:method, "d", 7]],
22
- 'a(b).c.d(e)'],
23
-
24
- [[[:method, "b", 4], [:method, "a", 2], [:method, "c", 7], [:method, "e", 13], [:method, "g", 11], [:method, "d", 9], [:method, "f", 0]],
25
- 'f(a(b).c.d(g(e)))'],
26
-
27
- [[[:method, "c", 5], [:method, "e", 11], [:method, "a", 0]],
28
- 'a(b: c, d: e)'],
29
-
30
- [[[:method, "b", 2], [:method, "c", 7], [:method, "d", 10], [:method, "e", 15], [:method, "a", 0]],
31
- 'a(b => c, d => e)'],
32
-
33
- [[[:method, "b", 4], [:method, "d", 10]],
34
- '{a: b, c: d}'],
35
-
36
- [[[:method, "a", 1], [:method, "b", 6], [:method, "c", 9], [:method, "d", 14]],
37
- '{a => b, c => d}'],
38
-
39
- [[[:method, "a", 2], [:method, "b", 5], [:method, "c", 10], [:method, "d", 13]],
40
- '[[a, b], [c, d]]'],
41
-
42
- [[[:method, "a", 0], [:method, "b", 2], [:method, "c", 5]],
43
- 'a b, c { d }'],
44
-
45
- [[[:method, "a", 20]],
46
- 'assertion_message { a }'],
47
-
48
- [[[:method, "a", 0]],
49
- 'a { b }'],
50
-
51
- [[[:method, "c", 4], [:method, "B", 2], [:method, "d", 8], [:method, "A", 0]],
52
- 'A(B(c), d)'],
53
-
54
- [[[:method, "c", 6], [:method, "f", 17], [:method, "h", 25], [:method, "a", 0]],
55
- 'a(b = c, (d, e = f), G = h)'],
56
-
57
- [[[:method, "b", 2], [:method, "c", 6], [:method, "d", 9], [:method, "e", 12], [:method, "g", 18], [:method, "i", 24], [:method, "j", 29], [:method, "a", 0]],
58
- 'a(b, *c, d, e, f: g, h: i, **j)'],
59
-
60
- [[[:method, "a", 0], [:method, "b", 5], [:method, "c", 9], [:method, "+", 7], [:method, "==", 2]],
61
- 'a == b + c'],
62
-
63
- [[[:ref, "var", 0], [:ref, "var", 8], [:method, "var", 4]],
64
- 'var.var(var)'],
65
-
66
- [[[:ref, "B", 2], [:ref, "@c", 5], [:ref, "@@d", 9], [:ref, "$e", 14], [:method, "f", 18], [:method, "self", 20], [:ref, "self", 26], [:method, "a", 0]],
67
- 'a(B, @c, @@d, $e, f.self, self)'],
68
-
69
- [[[:method, "a", 0], [:method, "c", 4], [:method, "b", 2]],
70
- 'a.b c'],
71
-
72
- [[[:method, "b", 4]],
73
- '"a#{b}c"'],
74
-
75
- [[[:method, "b", 4]],
76
- '/a#{b}c/'],
77
-
78
- [[],
79
- '[]'],
80
-
81
- [[[:method, "a", 0], [:method, "[]", 1]],
82
- 'a[0]'],
83
-
84
- # not supported
85
- [[],
86
- '[][]'],
87
-
88
- # not supported
89
- [[],
90
- '{}[]'],
91
-
92
- [[[:method, "a", 1], [:method, "!", 0]],
93
- '!a'],
94
-
95
- [[[:method, "a", 1], [:method, "+@", 0]],
96
- '+a'],
97
-
98
- [[[:method, "a", 1], [:method, "-@", 0]],
99
- '-a'],
100
-
101
- [[[:method, "a", 2], [:method, "!", 0], [:method, "b", 9], [:method, "+@", 8], [:method, "c", 15], [:method, "-@", 14],
102
- [:method, "==", 11], [:method, "==", 4]],
103
- '! a == (+b == -c)'],
104
-
105
- [[[:method, "b", 6]],
106
- '%x{a#{b}c}'],
107
-
108
- [[[:method, "a", 0], [:method, "b", 3]],
109
- "a..b"],
110
-
111
- [[[:method, "a", 0], [:method, "b", 4]],
112
- "a...b"],
113
-
114
- [[[:method, "b", 5]],
115
- ':"a#{b}c"'],
116
-
117
- # not supported
118
- [[],
119
- '->{}.()'],
120
-
121
- [[[:method, "a", 0], [:method, "b", 3], [:method, "call", 2]],
122
- 'a.(b)'],
123
- ]
124
-
125
- EXTRACT_METHODS_TEST.each_with_index do |(expect, source), idx|
126
- define_method("test_extract_methods_#{'%03d' % idx}") do
127
- pa = PowerAssert.const_get(:Context).new(-> { var = nil; -> { var } }.(), nil, TOPLEVEL_BINDING)
128
- pa.instance_variable_set(:@line, source)
129
- pa.instance_variable_set(:@assertion_method_name, 'assertion_message')
130
- assert_equal expect, pa.send(:extract_idents, Ripper.sexp(source)).map(&:to_a), source
131
- end
132
- end
133
-
134
- class BasicObjectSubclass < BasicObject
135
- def foo
136
- "foo"
137
- end
138
- end
139
-
140
- def assertion_message(source = nil, source_binding = TOPLEVEL_BINDING, &blk)
141
- ::PowerAssert.start(source || blk, assertion_method: __callee__, source_binding: source_binding) do |pa|
142
- pa.yield
143
- pa.message
144
- end
145
- end
146
-
147
- def Assertion(&blk)
148
- ::PowerAssert.start(blk, assertion_method: __callee__) do |pa|
149
- pa.yield
150
- pa.message
151
- end
152
- end
153
-
154
- define_method(:bmethod) do
155
- false
156
- end
157
-
158
- sub_test_case 'lazy_inspection' do
159
- t do
160
- PowerAssert.configure do |c|
161
- assert !c.lazy_inspection
162
- end
163
- assert_equal <<END.chomp, assertion_message {
164
- 'a'.sub(/./, 'b').sub!(/./, 'c')
165
- | |
166
- | "c"
167
- "b"
168
- END
169
- 'a'.sub(/./, 'b').sub!(/./, 'c')
170
- }
171
- end
172
-
173
- t do
174
- PowerAssert.configure do |c|
175
- c.lazy_inspection = true
176
- end
177
- begin
178
- assert_equal <<END.chomp, assertion_message {
179
- 'a'.sub(/./, 'b').sub!(/./, 'c')
180
- | |
181
- | "c"
182
- "c"
183
- END
184
- 'a'.sub(/./, 'b').sub!(/./, 'c')
185
- }
186
- ensure
187
- PowerAssert.configure do |c|
188
- c.lazy_inspection = false
189
- end
190
- end
191
- end
192
- end
193
-
194
- sub_test_case 'assertion_message' do
195
- t do
196
- a = 0
197
- @b = 1
198
- @@c = 2
199
- $d = 3
200
- assert_equal <<END.chomp, assertion_message {
201
- String(a) + String(@b) + String(@@c) + String($d)
202
- | | | | | | | | | | |
203
- | | | | | | | | | | 3
204
- | | | | | | | | | "3"
205
- | | | | | | | | "0123"
206
- | | | | | | | 2
207
- | | | | | | "2"
208
- | | | | | "012"
209
- | | | | 1
210
- | | | "1"
211
- | | "01"
212
- | 0
213
- "0"
214
- END
215
- String(a) + String(@b) + String(@@c) + String($d)
216
- }
217
- end
218
-
219
- t do
220
- assert_equal <<END.chomp, assertion_message {
221
- "0".class == "3".to_i.times.map {|i| i + 1 }.class
222
- | | | | | |
223
- | | | | | Array
224
- | | | | [1, 2, 3]
225
- | | | #<Enumerator: 3:times>
226
- | | 3
227
- | false
228
- String
229
- END
230
- "0".class == "3".to_i.times.map {|i| i + 1 }.class
231
- }
232
- end
233
-
234
- t do
235
- assert_equal '', assertion_message {
236
- false
237
- }
238
- end
239
-
240
- t do
241
- assert_equal <<END.chomp,
242
- assertion_message { "0".class }
243
- |
244
- String
245
- END
246
- assertion_message { "0".class }
247
- end
248
-
249
- t do
250
- assert_equal <<END.chomp,
251
- "0".class
252
- |
253
- String
254
- END
255
- Assertion {
256
- "0".class
257
- }
258
- end
259
-
260
- t do
261
- assert_equal <<END.chomp,
262
- Assertion { "0".class }
263
- |
264
- String
265
- END
266
- Assertion { "0".class }
267
- end
268
-
269
- t do
270
- assert_equal <<END.chomp, assertion_message {
271
- Set.new == Set.new([0])
272
- | | | | |
273
- | | | | #<Set: {0}>
274
- | | | Set
275
- | | false
276
- | #<Set: {}>
277
- Set
278
- END
279
- Set.new == Set.new([0])
280
- }
281
- end
282
-
283
- t do
284
- var = [10,20]
285
- assert_equal <<END.chomp, assertion_message {
286
- var[0] == 0
287
- | | |
288
- | | false
289
- | 10
290
- [10, 20]
291
- END
292
- var[0] == 0
293
- }
294
- end
295
-
296
- t do
297
- a = 1
298
- assert_equal <<END.chomp, assertion_message {
299
- ! a != (+a == -a)
300
- | | | || | ||
301
- | | | || | |1
302
- | | | || | -1
303
- | | | || false
304
- | | | |1
305
- | | | 1
306
- | | false
307
- | 1
308
- false
309
- END
310
- ! a != (+a == -a)
311
- }
312
- end
313
-
314
- t do
315
- assert_equal <<END.chomp, assertion_message {
316
- bmethod
317
- |
318
- false
319
- END
320
- bmethod
321
- }
322
- end
323
-
324
- t do
325
- a = :a
326
- assert_equal <<END.chomp, assertion_message {
327
- a == :b
328
- | |
329
- | false
330
- :a
331
- END
332
- a == :b
333
- }
334
- end
335
-
336
- t do
337
- assert_equal <<END.chomp, assertion_message {
338
- ! Object
339
- | |
340
- | Object
341
- false
342
- END
343
- ! Object
344
- }
345
- end
346
-
347
- if PowerAssert.respond_to?(:clear_global_method_cache, true)
348
- t do
349
- 3.times do
350
- assert_equal <<END.chomp, assertion_message {
351
- String == Array
352
- | | |
353
- | | Array
354
- | false
355
- String
356
- END
357
- String == Array
358
- }
359
- end
360
- end
361
- end
362
- end
363
-
364
- sub_test_case 'inspection_failure' do
365
- t do
366
- assert_match Regexp.new(<<END.chomp.gsub('|', "\\|")),
367
- assertion_message { BasicObjectSubclass.new.foo }
368
- | | |
369
- | | "foo"
370
- | InspectionFailure: NoMethodError: .*
371
- TestPowerAssert::BasicObjectSubclass
372
- END
373
- assertion_message { BasicObjectSubclass.new.foo }
374
- end
375
-
376
- t do
377
- o = Object.new
378
- def o.inspect
379
- raise
380
- end
381
- assert_equal <<END.chomp.b, assertion_message {
382
- o.class
383
- | |
384
- | Object
385
- InspectionFailure: RuntimeError:
386
- END
387
- o.class
388
- }
389
- end
390
- end
391
-
392
- sub_test_case 'alias_method' do
393
- def setup
394
- begin
395
- PowerAssert.configure do |c|
396
- c._trace_alias_method = true
397
- end unless PowerAssert.const_get(:SUPPORT_ALIAS_METHOD)
398
- @o = Class.new do
399
- def foo
400
- :foo
401
- end
402
- alias alias_of_iseq foo
403
- alias alias_of_cfunc to_s
404
- end
405
- yield
406
- ensure
407
- PowerAssert.configure do |c|
408
- c._trace_alias_method = false
409
- end unless PowerAssert.const_get(:SUPPORT_ALIAS_METHOD)
410
- end
411
- end
412
-
413
- t do
414
- assert_match Regexp.new(<<END.chomp.gsub('|', "\\|")),
415
- assertion_message { @o.new.alias_of_iseq }
416
- | | |
417
- | | :foo
418
- | #<#<Class:.*>:.*>
419
- #<Class:.*>
420
- END
421
- assertion_message { @o.new.alias_of_iseq }
422
- end
423
-
424
- t do
425
- unless PowerAssert.const_get(:SUPPORT_ALIAS_METHOD)
426
- omit 'alias of cfunc is not supported yet'
427
- end
428
- assert_match Regexp.new(<<END.chomp.gsub('|', "\\|")),
429
- assertion_message { @o.new.alias_of_cfunc }
430
- | | |
431
- | | "#<#<Class:.*>:.*>"
432
- | #<#<Class:.*>:.*>
433
- #<Class:.*>
434
- END
435
- assertion_message { @o.new.alias_of_cfunc }
436
- end
437
- end
438
-
439
- sub_test_case 'assertion_message_with_incompatible_encodings' do
440
- if Encoding.default_external == Encoding::UTF_8
441
- t do
442
- a = "\u3042"
443
- def a.inspect
444
- super.encode('utf-16le')
445
- end
446
- assert_equal <<END.chomp, assertion_message {
447
- a + a
448
- | | |
449
- | | "\u3042"(UTF-16LE)
450
- | "\u3042\u3042"
451
- "\u3042"(UTF-16LE)
452
- END
453
- a + a
454
- }
455
- end
456
- end
457
-
458
- t do
459
- a = "\xFF"
460
- def a.inspect
461
- "\xFF".force_encoding('ascii-8bit')
462
- end
463
- assert_equal <<END.chomp.b, assertion_message {
464
- a.length
465
- | |
466
- | 1
467
- \xFF
468
- END
469
- a.length
470
- }.b
471
- end
472
- end
473
-
474
- def test_assertion_message_with_string
475
- a, = 0, a # suppress "assigned but unused variable" warning
476
- @b = 1
477
- @@c = 2
478
- $d = 3
479
- assert_equal <<END.chomp, assertion_message(<<END, binding)
480
- String(a) + String(@b) + String(@@c) + String($d)
481
- | | | | | | | | | | |
482
- | | | | | | | | | | 3
483
- | | | | | | | | | "3"
484
- | | | | | | | | "0123"
485
- | | | | | | | 2
486
- | | | | | | "2"
487
- | | | | | "012"
488
- | | | | 1
489
- | | | "1"
490
- | | "01"
491
- | 0
492
- "0"
493
- END
494
- String(a) + String(@b) + String(@@c) + String($d)
495
- END
496
- end
497
-
498
- def test_workaround_for_ruby_2_2
499
- assert_nothing_raised do
500
- assertion_message { Thread.new {}.join }
501
- end
502
- end
503
-
504
- class H < Hash
505
- alias aref []
506
- protected :aref
507
- end
508
-
509
- def test_workaround_for_bug11182
510
- assert_nothing_raised do
511
- {}[:a]
512
- end
513
- end
514
- end