diff options
author | Benoit Daloze <eregontp@gmail.com> | 2020-05-03 12:28:29 +0200 |
---|---|---|
committer | Benoit Daloze <eregontp@gmail.com> | 2020-05-03 12:28:29 +0200 |
commit | 5aaa75e7c1f4b7912c10ffdcb1cac581e20eda39 (patch) | |
tree | e1694f5a4a5558884b1b8f3890b186793e5e982f /spec/ruby/core/string | |
parent | f646d20aaeb8f02bcd3d0c5c3f5a372da654502a (diff) | |
download | ruby-5aaa75e7c1f4b7912c10ffdcb1cac581e20eda39.tar.gz |
Update to ruby/spec@032ee74
Diffstat (limited to 'spec/ruby/core/string')
41 files changed, 183 insertions, 183 deletions
diff --git a/spec/ruby/core/string/capitalize_spec.rb b/spec/ruby/core/string/capitalize_spec.rb index 66d3b75f48..e6cf365ac3 100644 --- a/spec/ruby/core/string/capitalize_spec.rb +++ b/spec/ruby/core/string/capitalize_spec.rb @@ -14,8 +14,8 @@ describe "String#capitalize" do ruby_version_is ''...'2.7' do it "taints resulting string when self is tainted" do - "".taint.capitalize.tainted?.should == true - "hello".taint.capitalize.tainted?.should == true + "".taint.capitalize.should.tainted? + "hello".taint.capitalize.should.tainted? end end diff --git a/spec/ruby/core/string/center_spec.rb b/spec/ruby/core/string/center_spec.rb index 0284fc28dc..8a4be0a81e 100644 --- a/spec/ruby/core/string/center_spec.rb +++ b/spec/ruby/core/string/center_spec.rb @@ -49,11 +49,11 @@ describe "String#center with length, padding" do ruby_version_is ''...'2.7' do it "taints result when self or padstr is tainted" do - "x".taint.center(4).tainted?.should == true - "x".taint.center(0).tainted?.should == true - "".taint.center(0).tainted?.should == true - "x".taint.center(4, "*").tainted?.should == true - "x".center(4, "*".taint).tainted?.should == true + "x".taint.center(4).should.tainted? + "x".taint.center(0).should.tainted? + "".taint.center(0).should.tainted? + "x".taint.center(4, "*").should.tainted? + "x".center(4, "*".taint).should.tainted? end end diff --git a/spec/ruby/core/string/chop_spec.rb b/spec/ruby/core/string/chop_spec.rb index e9cd8f51d2..582d3c58c5 100644 --- a/spec/ruby/core/string/chop_spec.rb +++ b/spec/ruby/core/string/chop_spec.rb @@ -51,13 +51,13 @@ describe "String#chop" do ruby_version_is ''...'2.7' do it "taints result when self is tainted" do - "hello".taint.chop.tainted?.should == true - "".taint.chop.tainted?.should == true + "hello".taint.chop.should.tainted? + "".taint.chop.should.tainted? end it "untrusts result when self is untrusted" do - "hello".untrust.chop.untrusted?.should == true - "".untrust.chop.untrusted?.should == true + "hello".untrust.chop.should.untrusted? + "".untrust.chop.should.untrusted? end end diff --git a/spec/ruby/core/string/crypt_spec.rb b/spec/ruby/core/string/crypt_spec.rb index 6a9a4ae235..b947702492 100644 --- a/spec/ruby/core/string/crypt_spec.rb +++ b/spec/ruby/core/string/crypt_spec.rb @@ -33,10 +33,10 @@ describe "String#crypt" do tainted_salt.taint tainted_str.taint - "mypassword".crypt("$2a$04$0WVaz0pV3jzfZ5G5tpmHWu").tainted?.should == false - tainted_str.crypt("$2a$04$0WVaz0pV3jzfZ5G5tpmHWu").tainted?.should == true - "mypassword".crypt(tainted_salt).tainted?.should == true - tainted_str.crypt(tainted_salt).tainted?.should == true + "mypassword".crypt("$2a$04$0WVaz0pV3jzfZ5G5tpmHWu").should_not.tainted? + tainted_str.crypt("$2a$04$0WVaz0pV3jzfZ5G5tpmHWu").should.tainted? + "mypassword".crypt(tainted_salt).should.tainted? + tainted_str.crypt(tainted_salt).should.tainted? end end @@ -93,10 +93,10 @@ describe "String#crypt" do tainted_salt.taint tainted_str.taint - "hello".crypt("aa").tainted?.should == false - tainted_str.crypt("aa").tainted?.should == true - "hello".crypt(tainted_salt).tainted?.should == true - tainted_str.crypt(tainted_salt).tainted?.should == true + "hello".crypt("aa").should_not.tainted? + tainted_str.crypt("aa").should.tainted? + "hello".crypt(tainted_salt).should.tainted? + tainted_str.crypt(tainted_salt).should.tainted? end end diff --git a/spec/ruby/core/string/delete_prefix_spec.rb b/spec/ruby/core/string/delete_prefix_spec.rb index fb00d808b2..bd5b56a312 100644 --- a/spec/ruby/core/string/delete_prefix_spec.rb +++ b/spec/ruby/core/string/delete_prefix_spec.rb @@ -23,8 +23,8 @@ describe "String#delete_prefix" do ruby_version_is ''...'2.7' do it "taints resulting strings when other is tainted" do - 'hello'.taint.delete_prefix('hell').tainted?.should == true - 'hello'.taint.delete_prefix('').tainted?.should == true + 'hello'.taint.delete_prefix('hell').should.tainted? + 'hello'.taint.delete_prefix('').should.tainted? end end diff --git a/spec/ruby/core/string/delete_spec.rb b/spec/ruby/core/string/delete_spec.rb index ded63f1719..b6e54f8386 100644 --- a/spec/ruby/core/string/delete_spec.rb +++ b/spec/ruby/core/string/delete_spec.rb @@ -70,10 +70,10 @@ describe "String#delete" do ruby_version_is ''...'2.7' do it "taints result when self is tainted" do - "hello".taint.delete("e").tainted?.should == true - "hello".taint.delete("a-z").tainted?.should == true + "hello".taint.delete("e").should.tainted? + "hello".taint.delete("a-z").should.tainted? - "hello".delete("e".taint).tainted?.should == false + "hello".delete("e".taint).should_not.tainted? end end diff --git a/spec/ruby/core/string/delete_suffix_spec.rb b/spec/ruby/core/string/delete_suffix_spec.rb index d5b6880193..dbb5f9df9e 100644 --- a/spec/ruby/core/string/delete_suffix_spec.rb +++ b/spec/ruby/core/string/delete_suffix_spec.rb @@ -23,8 +23,8 @@ describe "String#delete_suffix" do ruby_version_is ''...'2.7' do it "taints resulting strings when other is tainted" do - 'hello'.taint.delete_suffix('ello').tainted?.should == true - 'hello'.taint.delete_suffix('').tainted?.should == true + 'hello'.taint.delete_suffix('ello').should.tainted? + 'hello'.taint.delete_suffix('').should.tainted? end end diff --git a/spec/ruby/core/string/downcase_spec.rb b/spec/ruby/core/string/downcase_spec.rb index 32e04e8a2c..8c840bdcc4 100644 --- a/spec/ruby/core/string/downcase_spec.rb +++ b/spec/ruby/core/string/downcase_spec.rb @@ -70,9 +70,9 @@ describe "String#downcase" do ruby_version_is ''...'2.7' do it "taints result when self is tainted" do - "".taint.downcase.tainted?.should == true - "x".taint.downcase.tainted?.should == true - "X".taint.downcase.tainted?.should == true + "".taint.downcase.should.tainted? + "x".taint.downcase.should.tainted? + "X".taint.downcase.should.tainted? end end diff --git a/spec/ruby/core/string/dump_spec.rb b/spec/ruby/core/string/dump_spec.rb index 260ee37adb..ebdd0167aa 100644 --- a/spec/ruby/core/string/dump_spec.rb +++ b/spec/ruby/core/string/dump_spec.rb @@ -5,18 +5,18 @@ require_relative 'fixtures/classes' describe "String#dump" do ruby_version_is ''...'2.7' do it "taints the result if self is tainted" do - "foo".taint.dump.tainted?.should == true - "foo\n".taint.dump.tainted?.should == true + "foo".taint.dump.should.tainted? + "foo\n".taint.dump.should.tainted? end it "untrusts the result if self is untrusted" do - "foo".untrust.dump.untrusted?.should == true - "foo\n".untrust.dump.untrusted?.should == true + "foo".untrust.dump.should.untrusted? + "foo\n".untrust.dump.should.untrusted? end end it "does not take into account if a string is frozen" do - "foo".freeze.dump.frozen?.should == false + "foo".freeze.dump.should_not.frozen? end it "returns a subclass instance" do diff --git a/spec/ruby/core/string/element_set_spec.rb b/spec/ruby/core/string/element_set_spec.rb index e375b4570e..641d46bc91 100644 --- a/spec/ruby/core/string/element_set_spec.rb +++ b/spec/ruby/core/string/element_set_spec.rb @@ -18,11 +18,11 @@ describe "String#[]= with Fixnum index" do it "taints self if other_str is tainted" do a = "hello" a[0] = "".taint - a.tainted?.should == true + a.should.tainted? a = "hello" a[0] = "x".taint - a.tainted?.should == true + a.should.tainted? end end @@ -491,11 +491,11 @@ describe "String#[]= with Fixnum index, count" do it "taints self if other_str is tainted" do a = "hello" a[0, 0] = "".taint - a.tainted?.should == true + a.should.tainted? a = "hello" a[1, 4] = "x".taint - a.tainted?.should == true + a.should.tainted? end end diff --git a/spec/ruby/core/string/empty_spec.rb b/spec/ruby/core/string/empty_spec.rb index fb52070723..8e53a16afc 100644 --- a/spec/ruby/core/string/empty_spec.rb +++ b/spec/ruby/core/string/empty_spec.rb @@ -3,10 +3,10 @@ require_relative 'fixtures/classes' describe "String#empty?" do it "returns true if the string has a length of zero" do - "hello".empty?.should == false - " ".empty?.should == false - "\x00".empty?.should == false - "".empty?.should == true - StringSpecs::MyString.new("").empty?.should == true + "hello".should_not.empty? + " ".should_not.empty? + "\x00".should_not.empty? + "".should.empty? + StringSpecs::MyString.new("").should.empty? end end diff --git a/spec/ruby/core/string/gsub_spec.rb b/spec/ruby/core/string/gsub_spec.rb index 8193464d48..23e0ad2260 100644 --- a/spec/ruby/core/string/gsub_spec.rb +++ b/spec/ruby/core/string/gsub_spec.rb @@ -171,14 +171,14 @@ describe "String#gsub with pattern and replacement" do hello_t.taint; a_t.taint; empty_t.taint - hello_t.gsub(/./, a).tainted?.should == true - hello_t.gsub(/./, empty).tainted?.should == true + hello_t.gsub(/./, a).should.tainted? + hello_t.gsub(/./, empty).should.tainted? - hello.gsub(/./, a_t).tainted?.should == true - hello.gsub(/./, empty_t).tainted?.should == true - hello.gsub(//, empty_t).tainted?.should == true + hello.gsub(/./, a_t).should.tainted? + hello.gsub(/./, empty_t).should.tainted? + hello.gsub(//, empty_t).should.tainted? - hello.gsub(//.taint, "foo").tainted?.should == false + hello.gsub(//.taint, "foo").should_not.tainted? end end @@ -199,14 +199,14 @@ describe "String#gsub with pattern and replacement" do hello_t.untrust; a_t.untrust; empty_t.untrust - hello_t.gsub(/./, a).untrusted?.should == true - hello_t.gsub(/./, empty).untrusted?.should == true + hello_t.gsub(/./, a).should.untrusted? + hello_t.gsub(/./, empty).should.untrusted? - hello.gsub(/./, a_t).untrusted?.should == true - hello.gsub(/./, empty_t).untrusted?.should == true - hello.gsub(//, empty_t).untrusted?.should == true + hello.gsub(/./, a_t).should.untrusted? + hello.gsub(/./, empty_t).should.untrusted? + hello.gsub(//, empty_t).should.untrusted? - hello.gsub(//.untrust, "foo").untrusted?.should == false + hello.gsub(//.untrust, "foo").should_not.untrusted? end end @@ -521,14 +521,14 @@ describe "String#gsub with pattern and block" do hello_t.untrust; a_t.untrust; empty_t.untrust - hello_t.gsub(/./) { a }.untrusted?.should == true - hello_t.gsub(/./) { empty }.untrusted?.should == true + hello_t.gsub(/./) { a }.should.untrusted? + hello_t.gsub(/./) { empty }.should.untrusted? - hello.gsub(/./) { a_t }.untrusted?.should == true - hello.gsub(/./) { empty_t }.untrusted?.should == true - hello.gsub(//) { empty_t }.untrusted?.should == true + hello.gsub(/./) { a_t }.should.untrusted? + hello.gsub(/./) { empty_t }.should.untrusted? + hello.gsub(//) { empty_t }.should.untrusted? - hello.gsub(//.untrust) { "foo" }.untrusted?.should == false + hello.gsub(//.untrust) { "foo" }.should_not.untrusted? end end @@ -594,14 +594,14 @@ describe "String#gsub! with pattern and replacement" do ruby_version_is ''...'2.7' do it "taints self if replacement is tainted" do a = "hello" - a.gsub!(/./.taint, "foo").tainted?.should == false - a.gsub!(/./, "foo".taint).tainted?.should == true + a.gsub!(/./.taint, "foo").should_not.tainted? + a.gsub!(/./, "foo".taint).should.tainted? end it "untrusts self if replacement is untrusted" do a = "hello" - a.gsub!(/./.untrust, "foo").untrusted?.should == false - a.gsub!(/./, "foo".untrust).untrusted?.should == true + a.gsub!(/./.untrust, "foo").should_not.untrusted? + a.gsub!(/./, "foo".untrust).should.untrusted? end end @@ -633,14 +633,14 @@ describe "String#gsub! with pattern and block" do ruby_version_is ''...'2.7' do it "taints self if block's result is tainted" do a = "hello" - a.gsub!(/./.taint) { "foo" }.tainted?.should == false - a.gsub!(/./) { "foo".taint }.tainted?.should == true + a.gsub!(/./.taint) { "foo" }.should_not.tainted? + a.gsub!(/./) { "foo".taint }.should.tainted? end it "untrusts self if block's result is untrusted" do a = "hello" - a.gsub!(/./.untrust) { "foo" }.untrusted?.should == false - a.gsub!(/./) { "foo".untrust }.untrusted?.should == true + a.gsub!(/./.untrust) { "foo" }.should_not.untrusted? + a.gsub!(/./) { "foo".untrust }.should.untrusted? end end diff --git a/spec/ruby/core/string/insert_spec.rb b/spec/ruby/core/string/insert_spec.rb index b26845419f..752cbb2f37 100644 --- a/spec/ruby/core/string/insert_spec.rb +++ b/spec/ruby/core/string/insert_spec.rb @@ -44,12 +44,12 @@ describe "String#insert with index, other" do ruby_version_is ''...'2.7' do it "taints self if string to insert is tainted" do str = "abcd" - str.insert(0, "T".taint).tainted?.should == true + str.insert(0, "T".taint).should.tainted? str = "abcd" other = mock('T') def other.to_str() "T".taint end - str.insert(0, other).tainted?.should == true + str.insert(0, other).should.tainted? end end diff --git a/spec/ruby/core/string/inspect_spec.rb b/spec/ruby/core/string/inspect_spec.rb index e63d89ead5..9818796c83 100644 --- a/spec/ruby/core/string/inspect_spec.rb +++ b/spec/ruby/core/string/inspect_spec.rb @@ -5,13 +5,13 @@ require_relative 'fixtures/classes' describe "String#inspect" do ruby_version_is ''...'2.7' do it "taints the result if self is tainted" do - "foo".taint.inspect.tainted?.should == true - "foo\n".taint.inspect.tainted?.should == true + "foo".taint.inspect.should.tainted? + "foo\n".taint.inspect.should.tainted? end it "untrusts the result if self is untrusted" do - "foo".untrust.inspect.untrusted?.should == true - "foo\n".untrust.inspect.untrusted?.should == true + "foo".untrust.inspect.should.untrusted? + "foo\n".untrust.inspect.should.untrusted? end end diff --git a/spec/ruby/core/string/ljust_spec.rb b/spec/ruby/core/string/ljust_spec.rb index f377e39775..481ef77ca8 100644 --- a/spec/ruby/core/string/ljust_spec.rb +++ b/spec/ruby/core/string/ljust_spec.rb @@ -33,11 +33,11 @@ describe "String#ljust with length, padding" do ruby_version_is ''...'2.7' do it "taints result when self or padstr is tainted" do - "x".taint.ljust(4).tainted?.should == true - "x".taint.ljust(0).tainted?.should == true - "".taint.ljust(0).tainted?.should == true - "x".taint.ljust(4, "*").tainted?.should == true - "x".ljust(4, "*".taint).tainted?.should == true + "x".taint.ljust(4).should.tainted? + "x".taint.ljust(0).should.tainted? + "".taint.ljust(0).should.tainted? + "x".taint.ljust(4, "*").should.tainted? + "x".ljust(4, "*".taint).should.tainted? end end diff --git a/spec/ruby/core/string/lstrip_spec.rb b/spec/ruby/core/string/lstrip_spec.rb index 902d660455..12c7b13200 100644 --- a/spec/ruby/core/string/lstrip_spec.rb +++ b/spec/ruby/core/string/lstrip_spec.rb @@ -16,9 +16,9 @@ describe "String#lstrip" do ruby_version_is ''...'2.7' do it "taints the result when self is tainted" do - "".taint.lstrip.tainted?.should == true - "ok".taint.lstrip.tainted?.should == true - " ok".taint.lstrip.tainted?.should == true + "".taint.lstrip.should.tainted? + "ok".taint.lstrip.should.tainted? + " ok".taint.lstrip.should.tainted? end end end diff --git a/spec/ruby/core/string/modulo_spec.rb b/spec/ruby/core/string/modulo_spec.rb index ad4b85e3c3..dc11ced4e2 100644 --- a/spec/ruby/core/string/modulo_spec.rb +++ b/spec/ruby/core/string/modulo_spec.rb @@ -319,8 +319,8 @@ describe "String#%" do subcls_format.taint format.taint - (format % universal).tainted?.should == true - (subcls_format % universal).tainted?.should == true + (format % universal).should.tainted? + (subcls_format % universal).should.tainted? end end end @@ -583,12 +583,12 @@ describe "String#%" do obj = mock('x') def obj.inspect() "x".taint end - ("%p" % obj).tainted?.should == true + ("%p" % obj).should.tainted? obj = mock('x'); obj.taint def obj.inspect() "x" end - ("%p" % obj).tainted?.should == false + ("%p" % obj).should_not.tainted? end end @@ -622,8 +622,8 @@ describe "String#%" do ruby_version_is ''...'2.7' do it "taints result for %s when argument is tainted" do - ("%s" % "x".taint).tainted?.should == true - ("%s" % mock('x').taint).tainted?.should == true + ("%s" % "x".taint).should.tainted? + ("%s" % mock('x').taint).should.tainted? end end @@ -789,7 +789,7 @@ describe "String#%" do ruby_version_is ''...'2.7' do it "doesn't taint the result for #{format} when argument is tainted" do - (format % "5".taint).tainted?.should == false + (format % "5".taint).should_not.tainted? end end end diff --git a/spec/ruby/core/string/reverse_spec.rb b/spec/ruby/core/string/reverse_spec.rb index 30d5385c83..cf4956a528 100644 --- a/spec/ruby/core/string/reverse_spec.rb +++ b/spec/ruby/core/string/reverse_spec.rb @@ -12,8 +12,8 @@ describe "String#reverse" do ruby_version_is ''...'2.7' do it "taints the result if self is tainted" do - "".taint.reverse.tainted?.should == true - "m".taint.reverse.tainted?.should == true + "".taint.reverse.should.tainted? + "m".taint.reverse.should.tainted? end end diff --git a/spec/ruby/core/string/rjust_spec.rb b/spec/ruby/core/string/rjust_spec.rb index 9285ecb6a7..bf39f4fdb9 100644 --- a/spec/ruby/core/string/rjust_spec.rb +++ b/spec/ruby/core/string/rjust_spec.rb @@ -33,11 +33,11 @@ describe "String#rjust with length, padding" do ruby_version_is ''...'2.7' do it "taints result when self or padstr is tainted" do - "x".taint.rjust(4).tainted?.should == true - "x".taint.rjust(0).tainted?.should == true - "".taint.rjust(0).tainted?.should == true - "x".taint.rjust(4, "*").tainted?.should == true - "x".rjust(4, "*".taint).tainted?.should == true + "x".taint.rjust(4).should.tainted? + "x".taint.rjust(0).should.tainted? + "".taint.rjust(0).should.tainted? + "x".taint.rjust(4, "*").should.tainted? + "x".rjust(4, "*".taint).should.tainted? end end diff --git a/spec/ruby/core/string/rstrip_spec.rb b/spec/ruby/core/string/rstrip_spec.rb index 0a01ffad73..57e1867956 100644 --- a/spec/ruby/core/string/rstrip_spec.rb +++ b/spec/ruby/core/string/rstrip_spec.rb @@ -16,9 +16,9 @@ describe "String#rstrip" do ruby_version_is ''...'2.7' do it "taints the result when self is tainted" do - "".taint.rstrip.tainted?.should == true - "ok".taint.rstrip.tainted?.should == true - "ok ".taint.rstrip.tainted?.should == true + "".taint.rstrip.should.tainted? + "ok".taint.rstrip.should.tainted? + "ok ".taint.rstrip.should.tainted? end end end diff --git a/spec/ruby/core/string/shared/chars.rb b/spec/ruby/core/string/shared/chars.rb index 9c7a4deb8b..1f045e4530 100644 --- a/spec/ruby/core/string/shared/chars.rb +++ b/spec/ruby/core/string/shared/chars.rb @@ -69,11 +69,11 @@ describe :string_chars, shared: true do str = "hello" str.send(@method) do |x| - x.tainted?.should == false + x.should_not.tainted? end str.dup.taint.send(@method) do |x| - x.tainted?.should == true + x.should.tainted? end end end diff --git a/spec/ruby/core/string/shared/concat.rb b/spec/ruby/core/string/shared/concat.rb index d127b08e9c..d6ffad7d4d 100644 --- a/spec/ruby/core/string/shared/concat.rb +++ b/spec/ruby/core/string/shared/concat.rb @@ -41,13 +41,13 @@ describe :string_concat, shared: true do ruby_version_is ''...'2.7' do it "taints self if other is tainted" do - "x".send(@method, "".taint).tainted?.should == true - "x".send(@method, "y".taint).tainted?.should == true + "x".send(@method, "".taint).should.tainted? + "x".send(@method, "y".taint).should.tainted? end it "untrusts self if other is untrusted" do - "x".send(@method, "".untrust).untrusted?.should == true - "x".send(@method, "y".untrust).untrusted?.should == true + "x".send(@method, "".untrust).should.untrusted? + "x".send(@method, "y".untrust).should.untrusted? end end diff --git a/spec/ruby/core/string/shared/each_line.rb b/spec/ruby/core/string/shared/each_line.rb index c82e63cfe8..156565ff13 100644 --- a/spec/ruby/core/string/shared/each_line.rb +++ b/spec/ruby/core/string/shared/each_line.rb @@ -42,9 +42,9 @@ describe :string_each_line, shared: true do ruby_version_is ''...'2.7' do it "taints substrings that are passed to the block if self is tainted" do - "one\ntwo\r\nthree".taint.send(@method) { |s| s.tainted?.should == true } + "one\ntwo\r\nthree".taint.send(@method) { |s| s.should.tainted? } - "x.y.".send(@method, ".".taint) { |s| s.tainted?.should == false } + "x.y.".send(@method, ".".taint) { |s| s.should_not.tainted? } end end diff --git a/spec/ruby/core/string/shared/replace.rb b/spec/ruby/core/string/shared/replace.rb index 3c5a15e12d..8dfac49f02 100644 --- a/spec/ruby/core/string/shared/replace.rb +++ b/spec/ruby/core/string/shared/replace.rb @@ -15,28 +15,28 @@ describe :string_replace, shared: true do a = "" b = "".taint a.send(@method, b) - a.tainted?.should == true + a.should.tainted? end it "does not untaint self if other is untainted" do a = "".taint b = "" a.send(@method, b) - a.tainted?.should == true + a.should.tainted? end it "untrusts self if other is untrusted" do a = "" b = "".untrust a.send(@method, b) - a.untrusted?.should == true + a.should.untrusted? end it "does not trust self if other is trusted" do a = "".untrust b = "" a.send(@method, b) - a.untrusted?.should == true + a.should.untrusted? end end diff --git a/spec/ruby/core/string/shared/slice.rb b/spec/ruby/core/string/shared/slice.rb index 1c438bc48d..6b6f37217a 100644 --- a/spec/ruby/core/string/shared/slice.rb +++ b/spec/ruby/core/string/shared/slice.rb @@ -85,9 +85,9 @@ describe :string_slice_index_length, shared: true do str = "hello world" str.taint - str.send(@method, 0,0).tainted?.should == true - str.send(@method, 0,1).tainted?.should == true - str.send(@method, 2,1).tainted?.should == true + str.send(@method, 0,0).should.tainted? + str.send(@method, 0,1).should.tainted? + str.send(@method, 2,1).should.tainted? end end @@ -243,12 +243,12 @@ describe :string_slice_range, shared: true do str = "hello world" str.taint - str.send(@method, 0..0).tainted?.should == true - str.send(@method, 0...0).tainted?.should == true - str.send(@method, 0..1).tainted?.should == true - str.send(@method, 0...1).tainted?.should == true - str.send(@method, 2..3).tainted?.should == true - str.send(@method, 2..0).tainted?.should == true + str.send(@method, 0..0).should.tainted? + str.send(@method, 0...0).should.tainted? + str.send(@method, 0..1).should.tainted? + str.send(@method, 0...1).should.tainted? + str.send(@method, 2..3).should.tainted? + str.send(@method, 2..0).should.tainted? end end @@ -338,7 +338,7 @@ describe :string_slice_regexp, shared: true do tainted_re = /./ tainted_re.taint - str.send(@method, tainted_re).tainted?.should == true + str.send(@method, tainted_re).should.tainted? end end @@ -395,9 +395,9 @@ describe :string_slice_regexp_index, shared: true do tainted_re = /(.)(.)(.)/ tainted_re.taint - str.send(@method, tainted_re, 0).tainted?.should == true - str.send(@method, tainted_re, 1).tainted?.should == true - str.send(@method, tainted_re, -1).tainted?.should == true + str.send(@method, tainted_re, 0).should.tainted? + str.send(@method, tainted_re, 1).should.tainted? + str.send(@method, tainted_re, -1).should.tainted? end end diff --git a/spec/ruby/core/string/shared/succ.rb b/spec/ruby/core/string/shared/succ.rb index 346ccee409..7ca488dd88 100644 --- a/spec/ruby/core/string/shared/succ.rb +++ b/spec/ruby/core/string/shared/succ.rb @@ -68,7 +68,7 @@ describe :string_succ, shared: true do ruby_version_is ''...'2.7' do it "taints the result if self is tainted" do ["", "a", "z", "Z", "9", "\xFF", "\xFF\xFF"].each do |s| - s.taint.send(@method).tainted?.should == true + s.taint.send(@method).should.tainted? end end end diff --git a/spec/ruby/core/string/shared/to_s.rb b/spec/ruby/core/string/shared/to_s.rb index 36283be4d0..b8c9b8ab44 100644 --- a/spec/ruby/core/string/shared/to_s.rb +++ b/spec/ruby/core/string/shared/to_s.rb @@ -13,8 +13,8 @@ describe :string_to_s, shared: true do ruby_version_is ''...'2.7' do it "taints the result when self is tainted" do - "x".taint.send(@method).tainted?.should == true - StringSpecs::MyString.new("x").taint.send(@method).tainted?.should == true + "x".taint.send(@method).should.tainted? + StringSpecs::MyString.new("x").taint.send(@method).should.tainted? end end end diff --git a/spec/ruby/core/string/shared/to_sym.rb b/spec/ruby/core/string/shared/to_sym.rb index 1180d64712..416f302aef 100644 --- a/spec/ruby/core/string/shared/to_sym.rb +++ b/spec/ruby/core/string/shared/to_sym.rb @@ -55,7 +55,7 @@ describe :string_to_sym, shared: true do it "raises an EncodingError for UTF-8 String containing invalid bytes" do invalid_utf8 = "\xC3" - invalid_utf8.valid_encoding?.should == false + invalid_utf8.should_not.valid_encoding? -> { invalid_utf8.send(@method) }.should raise_error(EncodingError, /invalid/) diff --git a/spec/ruby/core/string/slice_spec.rb b/spec/ruby/core/string/slice_spec.rb index a34dd1b8d4..bd0a63971b 100644 --- a/spec/ruby/core/string/slice_spec.rb +++ b/spec/ruby/core/string/slice_spec.rb @@ -99,8 +99,8 @@ describe "String#slice! with index, length" do str = "hello world" str.taint - str.slice!(0, 0).tainted?.should == true - str.slice!(2, 1).tainted?.should == true + str.slice!(0, 0).should.tainted? + str.slice!(2, 1).should.tainted? end end @@ -191,8 +191,8 @@ describe "String#slice! Range" do str = "hello world" str.taint - str.slice!(0..0).tainted?.should == true - str.slice!(2..3).tainted?.should == true + str.slice!(0..0).should.tainted? + str.slice!(2..3).should.tainted? end end @@ -288,14 +288,14 @@ describe "String#slice! with Regexp" do tainted_re = /./ tainted_re.taint - str.slice!(tainted_re).tainted?.should == true + str.slice!(tainted_re).should.tainted? end end it "doesn't taint self when regexp is tainted" do s = "hello" s.slice!(/./.taint) - s.tainted?.should == false + s.should_not.tainted? end end @@ -349,14 +349,14 @@ describe "String#slice! with Regexp, index" do tainted_re = /(.)(.)(.)/ tainted_re.taint - str.slice!(tainted_re, 1).tainted?.should == true + str.slice!(tainted_re, 1).should.tainted? end end it "doesn't taint self when regexp is tainted" do s = "hello" s.slice!(/(.)(.)/.taint, 1) - s.tainted?.should == false + s.should_not.tainted? end end diff --git a/spec/ruby/core/string/split_spec.rb b/spec/ruby/core/string/split_spec.rb index 8a740b04ca..34a50a5f13 100644 --- a/spec/ruby/core/string/split_spec.rb +++ b/spec/ruby/core/string/split_spec.rb @@ -189,11 +189,11 @@ describe "String#split with String" do ["", ".", " "].each do |pat| [-1, 0, 1, 2].each do |limit| str.dup.taint.split(pat).each do |x| - x.tainted?.should == true + x.should.tainted? end str.split(pat.dup.taint).each do |x| - x.tainted?.should == false + x.should_not.tainted? end end end diff --git a/spec/ruby/core/string/squeeze_spec.rb b/spec/ruby/core/string/squeeze_spec.rb index e54ed42b49..5a7fbb59de 100644 --- a/spec/ruby/core/string/squeeze_spec.rb +++ b/spec/ruby/core/string/squeeze_spec.rb @@ -56,11 +56,11 @@ describe "String#squeeze" do ruby_version_is ''...'2.7' do it "taints the result when self is tainted" do - "hello".taint.squeeze("e").tainted?.should == true - "hello".taint.squeeze("a-z").tainted?.should == true + "hello".taint.squeeze("e").should.tainted? + "hello".taint.squeeze("a-z").should.tainted? - "hello".squeeze("e".taint).tainted?.should == false - "hello".squeeze("l".taint).tainted?.should == false + "hello".squeeze("e".taint).should_not.tainted? + "hello".squeeze("l".taint).should_not.tainted? end end diff --git a/spec/ruby/core/string/strip_spec.rb b/spec/ruby/core/string/strip_spec.rb index 1838e07f32..252d4a9cc3 100644 --- a/spec/ruby/core/string/strip_spec.rb +++ b/spec/ruby/core/string/strip_spec.rb @@ -15,9 +15,9 @@ describe "String#strip" do ruby_version_is ''...'2.7' do it "taints the result when self is tainted" do - "".taint.strip.tainted?.should == true - "ok".taint.strip.tainted?.should == true - " ok ".taint.strip.tainted?.should == true + "".taint.strip.should.tainted? + "ok".taint.strip.should.tainted? + " ok ".taint.strip.should.tainted? end end end diff --git a/spec/ruby/core/string/sub_spec.rb b/spec/ruby/core/string/sub_spec.rb index f240cd8cff..80cf8622d5 100644 --- a/spec/ruby/core/string/sub_spec.rb +++ b/spec/ruby/core/string/sub_spec.rb @@ -148,14 +148,14 @@ describe "String#sub with pattern, replacement" do hello_t.taint; a_t.taint; empty_t.taint - hello_t.sub(/./, a).tainted?.should == true - hello_t.sub(/./, empty).tainted?.should == true + hello_t.sub(/./, a).should.tainted? + hello_t.sub(/./, empty).should.tainted? - hello.sub(/./, a_t).tainted?.should == true - hello.sub(/./, empty_t).tainted?.should == true - hello.sub(//, empty_t).tainted?.should == true + hello.sub(/./, a_t).should.tainted? + hello.sub(/./, empty_t).should.tainted? + hello.sub(//, empty_t).should.tainted? - hello.sub(//.taint, "foo").tainted?.should == false + hello.sub(//.taint, "foo").should_not.tainted? end end @@ -298,14 +298,14 @@ describe "String#sub with pattern and block" do hello_t.taint; a_t.taint; empty_t.taint - hello_t.sub(/./) { a }.tainted?.should == true - hello_t.sub(/./) { empty }.tainted?.should == true + hello_t.sub(/./) { a }.should.tainted? + hello_t.sub(/./) { empty }.should.tainted? - hello.sub(/./) { a_t }.tainted?.should == true - hello.sub(/./) { empty_t }.tainted?.should == true - hello.sub(//) { empty_t }.tainted?.should == true + hello.sub(/./) { a_t }.should.tainted? + hello.sub(/./) { empty_t }.should.tainted? + hello.sub(//) { empty_t }.should.tainted? - hello.sub(//.taint) { "foo" }.tainted?.should == false + hello.sub(//.taint) { "foo" }.should_not.tainted? end end end @@ -320,8 +320,8 @@ describe "String#sub! with pattern, replacement" do ruby_version_is ''...'2.7' do it "taints self if replacement is tainted" do a = "hello" - a.sub!(/./.taint, "foo").tainted?.should == false - a.sub!(/./, "foo".taint).tainted?.should == true + a.sub!(/./.taint, "foo").should_not.tainted? + a.sub!(/./, "foo".taint).should.tainted? end end @@ -370,8 +370,8 @@ describe "String#sub! with pattern and block" do ruby_version_is ''...'2.7' do it "taints self if block's result is tainted" do a = "hello" - a.sub!(/./.taint) { "foo" }.tainted?.should == false - a.sub!(/./) { "foo".taint }.tainted?.should == true + a.sub!(/./.taint) { "foo" }.should_not.tainted? + a.sub!(/./) { "foo".taint }.should.tainted? end end diff --git a/spec/ruby/core/string/swapcase_spec.rb b/spec/ruby/core/string/swapcase_spec.rb index d1e908d71d..0b50cc35c4 100644 --- a/spec/ruby/core/string/swapcase_spec.rb +++ b/spec/ruby/core/string/swapcase_spec.rb @@ -11,8 +11,8 @@ describe "String#swapcase" do ruby_version_is ''...'2.7' do it "taints resulting string when self is tainted" do - "".taint.swapcase.tainted?.should == true - "hello".taint.swapcase.tainted?.should == true + "".taint.swapcase.should.tainted? + "hello".taint.swapcase.should.tainted? end end diff --git a/spec/ruby/core/string/tr_s_spec.rb b/spec/ruby/core/string/tr_s_spec.rb index e004ab713c..cdf5667ea3 100644 --- a/spec/ruby/core/string/tr_s_spec.rb +++ b/spec/ruby/core/string/tr_s_spec.rb @@ -54,10 +54,10 @@ describe "String#tr_s" do ["h", "hello"].each do |str| tainted_str = str.dup.taint - tainted_str.tr_s("e", "a").tainted?.should == true + tainted_str.tr_s("e", "a").should.tainted? - str.tr_s("e".taint, "a").tainted?.should == false - str.tr_s("e", "a".taint).tainted?.should == false + str.tr_s("e".taint, "a").should_not.tainted? + str.tr_s("e", "a".taint).should_not.tainted? end end end diff --git a/spec/ruby/core/string/tr_spec.rb b/spec/ruby/core/string/tr_spec.rb index 0e4da398d5..212d06f679 100644 --- a/spec/ruby/core/string/tr_spec.rb +++ b/spec/ruby/core/string/tr_spec.rb @@ -66,10 +66,10 @@ describe "String#tr" do ["h", "hello"].each do |str| tainted_str = str.dup.taint - tainted_str.tr("e", "a").tainted?.should == true + tainted_str.tr("e", "a").should.tainted? - str.tr("e".taint, "a").tainted?.should == false - str.tr("e", "a".taint).tainted?.should == false + str.tr("e".taint, "a").should_not.tainted? + str.tr("e", "a".taint).should_not.tainted? end end end diff --git a/spec/ruby/core/string/uminus_spec.rb b/spec/ruby/core/string/uminus_spec.rb index 85b484b6df..91f91fdb1e 100644 --- a/spec/ruby/core/string/uminus_spec.rb +++ b/spec/ruby/core/string/uminus_spec.rb @@ -6,14 +6,14 @@ describe 'String#-@' do output = -input output.should equal(input) - output.frozen?.should == true + output.should.frozen? end it 'returns a frozen copy if the String is not frozen' do input = 'foo' output = -input - output.frozen?.should == true + output.should.frozen? output.should_not equal(input) output.should == 'foo' end diff --git a/spec/ruby/core/string/undump_spec.rb b/spec/ruby/core/string/undump_spec.rb index 81deb6fa58..b990aa25ee 100644 --- a/spec/ruby/core/string/undump_spec.rb +++ b/spec/ruby/core/string/undump_spec.rb @@ -5,16 +5,16 @@ require_relative 'fixtures/classes' describe "String#undump" do ruby_version_is ''...'2.7' do it "taints the result if self is tainted" do - '"foo"'.taint.undump.tainted?.should == true + '"foo"'.taint.undump.should.tainted? end it "untrusts the result if self is untrusted" do - '"foo"'.untrust.undump.untrusted?.should == true + '"foo"'.untrust.undump.should.untrusted? end end it "does not take into account if a string is frozen" do - '"foo"'.freeze.undump.frozen?.should == false + '"foo"'.freeze.undump.should_not.frozen? end it "always returns String instance" do diff --git a/spec/ruby/core/string/unicode_normalized_spec.rb b/spec/ruby/core/string/unicode_normalized_spec.rb index 25c810a98f..87f3740459 100644 --- a/spec/ruby/core/string/unicode_normalized_spec.rb +++ b/spec/ruby/core/string/unicode_normalized_spec.rb @@ -24,16 +24,16 @@ describe "String#unicode_normalized?" do end it "defaults to the nfc normalization form if no forms are specified" do - @nfc_normalized_str.unicode_normalized?.should == true - @nfd_normalized_str.unicode_normalized?.should == false + @nfc_normalized_str.should.unicode_normalized? + @nfd_normalized_str.should_not.unicode_normalized? end it "returns true if string is empty" do - "".unicode_normalized?.should == true + "".should.unicode_normalized? end it "returns true if string does not contain any unicode codepoints" do - "abc".unicode_normalized?.should == true + "abc".should.unicode_normalized? end it "raises an Encoding::CompatibilityError if the string is not in an unicode encoding" do diff --git a/spec/ruby/core/string/upcase_spec.rb b/spec/ruby/core/string/upcase_spec.rb index c440b1b0aa..13ebd09a95 100644 --- a/spec/ruby/core/string/upcase_spec.rb +++ b/spec/ruby/core/string/upcase_spec.rb @@ -67,9 +67,9 @@ describe "String#upcase" do ruby_version_is ''...'2.7' do it "taints result when self is tainted" do - "".taint.upcase.tainted?.should == true - "X".taint.upcase.tainted?.should == true - "x".taint.upcase.tainted?.should == true + "".taint.upcase.should.tainted? + "X".taint.upcase.should.tainted? + "x".taint.upcase.should.tainted? end end diff --git a/spec/ruby/core/string/uplus_spec.rb b/spec/ruby/core/string/uplus_spec.rb index a7402b4549..038b283c90 100644 --- a/spec/ruby/core/string/uplus_spec.rb +++ b/spec/ruby/core/string/uplus_spec.rb @@ -5,7 +5,7 @@ describe 'String#+@' do input = 'foo'.freeze output = +input - output.frozen?.should == false + output.should_not.frozen? output.should == 'foo' end |