summaryrefslogtreecommitdiff
path: root/spec/ruby/core/proc/clone_spec.rb
diff options
context:
space:
mode:
authorJean Boussier <byroot@ruby-lang.org>2024-02-12 12:03:36 +0100
committerJean Boussier <jean.boussier@gmail.com>2024-02-12 18:31:48 +0100
commitde1a586ecc2ee7f465f0c0a69291054136a3a819 (patch)
treed6825acfea6f796b5f5dbb2746fe7fcb1c07d580 /spec/ruby/core/proc/clone_spec.rb
parentc04782c2cb56c512e1d1b34630cb942da3aeb366 (diff)
proc.c: get rid of `CLONESETUP`
[Bug #20253] All the way down to Ruby 1.9, `Proc`, `Method`, `UnboundMethod` and `Binding` always had their own specific clone and dup routine. This caused various discrepancies with how other objects behave on `dup` and `clone. [Bug #20250], [Bug #20253]. This commit get rid of `CLONESETUP` and use the the same codepath as all other types, so ensure consistency. NB: It's still not accepting the `freeze` keyword argument on `clone`. Co-Authored-By: Étienne Barrié <etienne.barrie@gmail.com>
Diffstat (limited to 'spec/ruby/core/proc/clone_spec.rb')
-rw-r--r--spec/ruby/core/proc/clone_spec.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/spec/ruby/core/proc/clone_spec.rb b/spec/ruby/core/proc/clone_spec.rb
index a1a1292654..7eca9c561e 100644
--- a/spec/ruby/core/proc/clone_spec.rb
+++ b/spec/ruby/core/proc/clone_spec.rb
@@ -3,4 +3,13 @@ require_relative 'shared/dup'
describe "Proc#clone" do
it_behaves_like :proc_dup, :clone
+
+ ruby_bug "cloning a frozen proc is broken on Ruby 3.3", "3.3"..."3.4" do
+ it "preserves frozen status" do
+ proc = Proc.new { }
+ proc.freeze
+ proc.frozen?.should == true
+ proc.clone.frozen?.should == true
+ end
+ end
end