aboutsummaryrefslogtreecommitdiffstats
path: root/spec/ruby/core/string/dup_spec.rb
diff options
context:
space:
mode:
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