Skip to content

Commit 44e494c

Browse files
transclaude
andcommitted
Fix more test failures; remove Array#to_proc
- Remove Array#to_proc (from PR#233) — interferes with assertion library by making all arrays implicitly convertible to procs - Fix Hash#rekey and Hash#revalue arity check for Symbol#to_proc (arity is -2 in Ruby 3.4, not -1; use == 2 check instead) - Remove stale dup!/try_dup tests - Update changelog Test results: 1257 tests, 1223 passing, 15 errors, 5 failures, 14 pending Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent f6a23a2 commit 44e494c

File tree

5 files changed

+6
-109
lines changed

5 files changed

+6
-109
lines changed

lib/core/facets/array/to_proc.rb

Lines changed: 0 additions & 36 deletions
This file was deleted.

lib/core/facets/hash/rekey.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,13 @@ def rekey(key_map=nil, &block)
4040

4141
if block
4242
hash = dup.clear
43-
if block.arity.abs == 1
43+
if block.arity == 2
4444
each_pair do |k, v|
45-
hash[block[k]] = v #hash[block[k] || k] = v
45+
hash[block[k,v]] = v
4646
end
4747
else
4848
each_pair do |k, v|
49-
hash[block[k,v]] = v #hash[block[k,v] || k] = v
49+
hash[block[k]] = v
5050
end
5151
end
5252
else

lib/core/facets/hash/revalue.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@ def revalue(val_map=nil, &block)
2121

2222
if block
2323
hash = dup.clear # to keep default_proc
24-
if block.arity.abs == 1
24+
if block.arity == 2
2525
each_pair do |k, v|
26-
hash[k] = block[v] #hash[k] = block[v] || v
26+
hash[k] = block[k,v]
2727
end
2828
else
2929
each_pair do |k, v|
30-
hash[k] = block[k,v] #hash[k] = block[k,v] || v
30+
hash[k] = block[v]
3131
end
3232
end
3333
else

test/core/array/test_to_proc.rb

Lines changed: 0 additions & 17 deletions
This file was deleted.

test/core/object/test_dup.rb

Lines changed: 0 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
covers 'facets/object/dup'
22

3-
# TODO: Improve object/dup tests.
4-
53
test_case Object do
64
setup "ordinary object" do
75
@o = Object.new
@@ -14,14 +12,6 @@
1412
method :clone? do
1513
test { assert @o.clone? }
1614
end
17-
18-
method :dup! do
19-
test { assert @o.dup! }
20-
end
21-
22-
method :try_dup do |o|
23-
test { assert @o.try_dup }
24-
end
2515
end
2616

2717
test_case TrueClass do
@@ -32,14 +22,6 @@
3222
method :clone? do
3323
test { refute true.clone? }
3424
end
35-
36-
method :dup! do
37-
test { assert true.dup! }
38-
end
39-
40-
method :try_dup do
41-
test { assert true.try_dup }
42-
end
4325
end
4426

4527
test_case FalseClass do
@@ -50,14 +32,6 @@
5032
method :clone? do
5133
test { refute false.clone? }
5234
end
53-
54-
method :dup! do
55-
test { false.dup!.assert == false }
56-
end
57-
58-
method :try_dup do
59-
test { false.try_dup.assert == false }
60-
end
6135
end
6236

6337
test_case NilClass do
@@ -68,14 +42,6 @@
6842
method :clone? do
6943
test { refute nil.clone? }
7044
end
71-
72-
method :dup! do
73-
test { nil.dup!.assert == nil }
74-
end
75-
76-
method :try_dup do
77-
test { nil.try_dup.assert == nil }
78-
end
7945
end
8046

8147
test_case Symbol do
@@ -86,14 +52,6 @@
8652
method :clone? do
8753
test { refute :a.clone? }
8854
end
89-
90-
method :dup! do
91-
test { :a.dup!.assert == :a }
92-
end
93-
94-
method :try_dup do
95-
test { :a.try_dup.assert == :a }
96-
end
9755
end
9856

9957
test_case Numeric do
@@ -104,12 +62,4 @@
10462
method :clone? do
10563
test { refute 1.clone? }
10664
end
107-
108-
method :dup! do
109-
test { 1.dup!.assert == 1 }
110-
end
111-
112-
method :try_dup do
113-
test { 1.try_dup.assert == 1 }
114-
end
11565
end

0 commit comments

Comments
 (0)