diff options
Diffstat (limited to 'spec/ruby/library/stringscanner')
4 files changed, 25 insertions, 20 deletions
diff --git a/spec/ruby/library/stringscanner/initialize_spec.rb b/spec/ruby/library/stringscanner/initialize_spec.rb index 07f71572ce..047d9d058b 100644 --- a/spec/ruby/library/stringscanner/initialize_spec.rb +++ b/spec/ruby/library/stringscanner/initialize_spec.rb @@ -12,7 +12,6 @@ describe "StringScanner#initialize" do it "returns an instance of StringScanner" do @s.should be_kind_of(StringScanner) - @s.tainted?.should be_false @s.eos?.should be_false end diff --git a/spec/ruby/library/stringscanner/shared/extract_range.rb b/spec/ruby/library/stringscanner/shared/extract_range.rb index 7e98540b1a..1c14f716c9 100644 --- a/spec/ruby/library/stringscanner/shared/extract_range.rb +++ b/spec/ruby/library/stringscanner/shared/extract_range.rb @@ -9,14 +9,16 @@ describe :extract_range, shared: true do ch.should be_an_instance_of(String) end - it "taints the returned String if the input was tainted" do - str = 'abc' - str.taint + ruby_version_is ''...'2.7' do + it "taints the returned String if the input was tainted" do + str = 'abc' + str.taint - s = StringScanner.new(str) + s = StringScanner.new(str) - s.send(@method).tainted?.should be_true - s.send(@method).tainted?.should be_true - s.send(@method).tainted?.should be_true + s.send(@method).tainted?.should be_true + s.send(@method).tainted?.should be_true + s.send(@method).tainted?.should be_true + end end end diff --git a/spec/ruby/library/stringscanner/shared/extract_range_matched.rb b/spec/ruby/library/stringscanner/shared/extract_range_matched.rb index fe695e8ac1..5c536f5c01 100644 --- a/spec/ruby/library/stringscanner/shared/extract_range_matched.rb +++ b/spec/ruby/library/stringscanner/shared/extract_range_matched.rb @@ -11,12 +11,14 @@ describe :extract_range_matched, shared: true do ch.should be_an_instance_of(String) end - it "taints the returned String if the input was tainted" do - str = 'abc' - str.taint + ruby_version_is ''...'2.7' do + it "taints the returned String if the input was tainted" do + str = 'abc' + str.taint - s = StringScanner.new(str) - s.scan(/\w{1}/) - s.send(@method).tainted?.should be_true + s = StringScanner.new(str) + s.scan(/\w{1}/) + s.send(@method).tainted?.should be_true + end end end diff --git a/spec/ruby/library/stringscanner/shared/peek.rb b/spec/ruby/library/stringscanner/shared/peek.rb index a59afdc6c0..4e2e643353 100644 --- a/spec/ruby/library/stringscanner/shared/peek.rb +++ b/spec/ruby/library/stringscanner/shared/peek.rb @@ -37,11 +37,13 @@ describe :strscan_peek, shared: true do ch.should be_an_instance_of(String) end - it "taints the returned String if the input was tainted" do - str = 'abc' - str.taint - - s = StringScanner.new(str) - s.send(@method, 1).tainted?.should be_true + ruby_version_is ''...'2.7' do + it "taints the returned String if the input was tainted" do + str = 'abc' + str.taint + + s = StringScanner.new(str) + s.send(@method, 1).tainted?.should be_true + end end end |