aboutsummaryrefslogtreecommitdiffstats
path: root/spec/ruby/core/string/dup_spec.rb
diff options
context:
space:
mode:
authorBenoit Daloze <eregontp@gmail.com>2022-06-26 14:50:14 +0200
committerBenoit Daloze <eregontp@gmail.com>2022-06-26 14:50:14 +0200
commitd3d5ef0cca160fca538c7f556c5a6e08df5847e6 (patch)
tree57358b4b9cdd6f429d0383005ac393cb74dd3bff /spec/ruby/core/string/dup_spec.rb
parentf616e816372d14e605879d2e43c7fbdda29ef837 (diff)
downloadruby-d3d5ef0cca160fca538c7f556c5a6e08df5847e6.tar.gz
Update to ruby/spec@ab32a1a
Diffstat (limited to 'spec/ruby/core/string/dup_spec.rb')
-rw-r--r--spec/ruby/core/string/dup_spec.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/spec/ruby/core/string/dup_spec.rb b/spec/ruby/core/string/dup_spec.rb
index d650788210..eec3cf0a70 100644
--- a/spec/ruby/core/string/dup_spec.rb
+++ b/spec/ruby/core/string/dup_spec.rb
@@ -49,4 +49,13 @@ describe "String#dup" do
orig.should == "xtring"
dup.should == "string"
end
+
+ it "does not modify the original setbyte-mutated string when changing dupped string" do
+ orig = "a"
+ orig.setbyte 0, "b".ord
+ copy = orig.dup
+ orig.setbyte 0, "c".ord
+ orig.should == "c"
+ copy.should == "b"
+ end
end