power_assert 0.2.5 → 0.2.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 74a0fc57d637b6ad58b841c4be18f3713e5d5fec
4
- data.tar.gz: 3b7a5199fd47f8b6f84cd7a69f21eb18264705c8
3
+ metadata.gz: 23e0669403c76859a457a6b603d6654e1dac29a1
4
+ data.tar.gz: 31bcdb3aa8bdb10472e13fea16f6ab918b3cfce7
5
5
  SHA512:
6
- metadata.gz: 923684a3d1b4b23aded7a0c2cb562881c2f233a2d6a7fb076fddddcab20ebdb9a76c1c8ceef8bfa8935bc7bb6432ce2c4602bb8be22291e46b9a271ea817d5ce
7
- data.tar.gz: f09059785e9a319dda90d3d01aad3f632f3f6a22b812f0ad0d18f2ae441a373d3a2dc9027bdf0311e05ba92dd1495060f03f0e0bbc5fa18d32cc8302424d3bbe
6
+ metadata.gz: dade7bfd8ddb550f749142a011c7e2a7aa4d6800e219fe86a7288ad71752840b811a4f1d88c39759af035648f1aaf51393987a9ab8ae46ad85368f418e362e0d
7
+ data.tar.gz: 9046bea3244c4482f9f74d25ba7265333a11b52663cefc3aec0b17514b34c9c5e652bcb68b8822234342de6e5fb1510b92587b8ac6cf1bbf8b67bb8d1b6da873
@@ -13,14 +13,47 @@ if defined? RubyVM
13
13
  :length, :size, :empty?, :succ, :>, :>=, :!, :!=, :=~, :freeze
14
14
  ]
15
15
 
16
- basic_classes.each do |klass|
17
- basic_operators.each do |bop|
18
- refine(klass) do
19
- define_method(bop) {}
20
- end
16
+ class Bug11182
17
+ def fixed?
18
+ true
19
+ end
20
+ end
21
+
22
+ refine Bug11182 do
23
+ def fixed?
21
24
  end
22
25
  end
23
26
 
27
+ class Bug11182Sub < Bug11182
28
+ alias _fixed? fixed?
29
+ protected :_fixed?
30
+ end
31
+
32
+ if (Bug11182.new.fixed? rescue false)
33
+ basic_classes.each do |klass|
34
+ basic_operators.each do |bop|
35
+ refine(klass) do
36
+ define_method(bop) {}
37
+ end
38
+ end
39
+ end
40
+ else
41
+ # workaround for https://bugs.ruby-lang.org/issues/11182
42
+ basic_classes.each do |klass|
43
+ basic_operators.each do |bop|
44
+ if klass.public_method_defined?(bop)
45
+ klass.ancestors.find {|i| i.instance_methods(false).index(bop) }.module_eval do
46
+ public bop
47
+ end
48
+ end
49
+ end
50
+ end
51
+
52
+ refine Symbol do
53
+ def ==
54
+ end
55
+ end
56
+ end
24
57
 
25
58
  # bypass check_cfunc
26
59
  refine BasicObject do
@@ -1,3 +1,3 @@
1
1
  module PowerAssert
2
- VERSION = "0.2.5"
2
+ VERSION = "0.2.6"
3
3
  end
@@ -429,4 +429,15 @@ END
429
429
  assertion_message { Thread.new {}.join }
430
430
  end
431
431
  end
432
+
433
+ class H < Hash
434
+ alias aref []
435
+ protected :aref
436
+ end
437
+
438
+ def test_workaround_for_bug11182
439
+ assert_nothing_raised do
440
+ {}[:a]
441
+ end
442
+ end
432
443
  end
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.2.5
4
+ version: 0.2.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kazuki Tsujimoto
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-10-30 00:00:00.000000000 Z
11
+ date: 2015-11-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: test-unit