summaryrefslogtreecommitdiff
path: root/spec/ruby/core/string
diff options
context:
space:
mode:
authorBenoit Daloze <eregontp@gmail.com>2019-05-28 22:41:48 +0200
committerBenoit Daloze <eregontp@gmail.com>2019-05-28 22:41:48 +0200
commita66bc2c01194a9c017c874a30db5b3b6bd95e966 (patch)
tree598d6375b44fd86f90c3477c73086f6fcf08d76c /spec/ruby/core/string
parentd070523e7be4b95914adeef9a10401fba7718c5a (diff)
Update to ruby/spec@9a501a8
Diffstat (limited to 'spec/ruby/core/string')
-rw-r--r--spec/ruby/core/string/uminus_spec.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/spec/ruby/core/string/uminus_spec.rb b/spec/ruby/core/string/uminus_spec.rb
index fd9e8c1d52..dace04846c 100644
--- a/spec/ruby/core/string/uminus_spec.rb
+++ b/spec/ruby/core/string/uminus_spec.rb
@@ -41,6 +41,23 @@ describe 'String#-@' do
(-dynamic).should_not equal("this string is frozen".freeze)
(-dynamic).should_not equal(-"this string is frozen".freeze)
+ (-dynamic).should == "this string is frozen"
+ end
+
+ it "does not deduplicate tainted strings" do
+ dynamic = %w(this string is frozen).join(' ')
+ dynamic.taint
+ (-dynamic).should_not equal("this string is frozen".freeze)
+ (-dynamic).should_not equal(-"this string is frozen".freeze)
+ (-dynamic).should == "this string is frozen"
+ end
+
+ it "does not deduplicate strings with additional instance variables" do
+ dynamic = %w(this string is frozen).join(' ')
+ dynamic.instance_variable_set(:@foo, :bar)
+ (-dynamic).should_not equal("this string is frozen".freeze)
+ (-dynamic).should_not equal(-"this string is frozen".freeze)
+ (-dynamic).should == "this string is frozen"
end
end