-
Notifications
You must be signed in to change notification settings - Fork 188
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[GR-34365] Handle Kernel#clone with freeze: true argument (#2512)
PullRequest: truffleruby/3031
- Loading branch information
Showing
13 changed files
with
181 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
require_relative '../../spec_helper' | ||
|
||
describe "Kernel#initialize_clone" do | ||
it "is a private instance method" do | ||
Kernel.should have_private_instance_method(:initialize_clone) | ||
end | ||
|
||
it "returns the receiver" do | ||
a = Object.new | ||
b = Object.new | ||
a.send(:initialize_clone, b).should == a | ||
end | ||
|
||
it "calls #initialize_copy" do | ||
a = Object.new | ||
b = Object.new | ||
a.should_receive(:initialize_copy).with(b) | ||
a.send(:initialize_clone, b) | ||
end | ||
|
||
ruby_version_is "3.0" do | ||
it "accepts a :freeze keyword argument for obj.clone(freeze: value)" do | ||
a = Object.new | ||
b = Object.new | ||
a.send(:initialize_clone, b, freeze: true).should == a | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
require_relative '../../spec_helper' | ||
|
||
describe "Kernel#initialize_dup" do | ||
it "is a private instance method" do | ||
Kernel.should have_private_instance_method(:initialize_dup) | ||
end | ||
|
||
it "returns the receiver" do | ||
a = Object.new | ||
b = Object.new | ||
a.send(:initialize_dup, b).should == a | ||
end | ||
|
||
it "calls #initialize_copy" do | ||
a = Object.new | ||
b = Object.new | ||
a.should_receive(:initialize_copy).with(b) | ||
a.send(:initialize_dup, b) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.