diff options
Diffstat (limited to 'spec/ruby/library')
-rw-r--r-- | spec/ruby/library/delegate/delegator/taint_spec.rb | 24 | ||||
-rw-r--r-- | spec/ruby/library/delegate/delegator/trust_spec.rb | 22 | ||||
-rw-r--r-- | spec/ruby/library/delegate/delegator/untaint_spec.rb | 26 | ||||
-rw-r--r-- | spec/ruby/library/delegate/delegator/untrust_spec.rb | 24 | ||||
-rw-r--r-- | spec/ruby/library/pathname/new_spec.rb | 8 | ||||
-rw-r--r-- | spec/ruby/library/readline/history/delete_at_spec.rb | 12 | ||||
-rw-r--r-- | spec/ruby/library/readline/history/each_spec.rb | 8 | ||||
-rw-r--r-- | spec/ruby/library/readline/history/element_reference_spec.rb | 8 | ||||
-rw-r--r-- | spec/ruby/library/readline/history/pop_spec.rb | 12 | ||||
-rw-r--r-- | spec/ruby/library/readline/history/shift_spec.rb | 12 | ||||
-rw-r--r-- | spec/ruby/library/readline/readline_spec.rb | 8 | ||||
-rw-r--r-- | spec/ruby/library/stringscanner/initialize_spec.rb | 1 | ||||
-rw-r--r-- | spec/ruby/library/stringscanner/shared/extract_range.rb | 16 | ||||
-rw-r--r-- | spec/ruby/library/stringscanner/shared/extract_range_matched.rb | 14 | ||||
-rw-r--r-- | spec/ruby/library/stringscanner/shared/peek.rb | 14 |
15 files changed, 118 insertions, 91 deletions
diff --git a/spec/ruby/library/delegate/delegator/taint_spec.rb b/spec/ruby/library/delegate/delegator/taint_spec.rb index 2dd0493b53..b875b5a6b8 100644 --- a/spec/ruby/library/delegate/delegator/taint_spec.rb +++ b/spec/ruby/library/delegate/delegator/taint_spec.rb @@ -6,18 +6,20 @@ describe "Delegator#taint" do @delegate = DelegateSpecs::Delegator.new("") end - it "returns self" do - @delegate.taint.equal?(@delegate).should be_true - end + ruby_version_is ''...'2.7' do + it "returns self" do + @delegate.taint.equal?(@delegate).should be_true + end - it "taints the delegator" do - @delegate.__setobj__(nil) - @delegate.taint - @delegate.tainted?.should be_true - end + it "taints the delegator" do + @delegate.__setobj__(nil) + @delegate.taint + @delegate.tainted?.should be_true + end - it "taints the delegated object" do - @delegate.taint - @delegate.__getobj__.tainted?.should be_true + it "taints the delegated object" do + @delegate.taint + @delegate.__getobj__.tainted?.should be_true + end end end diff --git a/spec/ruby/library/delegate/delegator/trust_spec.rb b/spec/ruby/library/delegate/delegator/trust_spec.rb index ba57b3ea18..492f02e27f 100644 --- a/spec/ruby/library/delegate/delegator/trust_spec.rb +++ b/spec/ruby/library/delegate/delegator/trust_spec.rb @@ -6,17 +6,19 @@ describe "Delegator#trust" do @delegate = DelegateSpecs::Delegator.new([]) end - it "returns self" do - @delegate.trust.equal?(@delegate).should be_true - end + ruby_version_is ''...'2.7' do + it "returns self" do + @delegate.trust.equal?(@delegate).should be_true + end - it "trusts the delegator" do - @delegate.trust - @delegate.untrusted?.should be_false - end + it "trusts the delegator" do + @delegate.trust + @delegate.untrusted?.should be_false + end - it "trusts the delegated object" do - @delegate.trust - @delegate.__getobj__.untrusted?.should be_false + it "trusts the delegated object" do + @delegate.trust + @delegate.__getobj__.untrusted?.should be_false + end end end diff --git a/spec/ruby/library/delegate/delegator/untaint_spec.rb b/spec/ruby/library/delegate/delegator/untaint_spec.rb index ddcf854a43..3f8f7721a9 100644 --- a/spec/ruby/library/delegate/delegator/untaint_spec.rb +++ b/spec/ruby/library/delegate/delegator/untaint_spec.rb @@ -6,19 +6,21 @@ describe "Delegator#untaint" do @delegate = -> { DelegateSpecs::Delegator.new("") }.call end - it "returns self" do - @delegate.untaint.equal?(@delegate).should be_true - end + ruby_version_is ''...'2.7' do + it "returns self" do + @delegate.untaint.equal?(@delegate).should be_true + end - it "untaints the delegator" do - @delegate.untaint - @delegate.tainted?.should be_false - # No additional meaningful test; that it does or not taint - # "for real" the delegator has no consequence - end + it "untaints the delegator" do + @delegate.untaint + @delegate.tainted?.should be_false + # No additional meaningful test; that it does or not taint + # "for real" the delegator has no consequence + end - it "untaints the delegated object" do - @delegate.untaint - @delegate.__getobj__.tainted?.should be_false + it "untaints the delegated object" do + @delegate.untaint + @delegate.__getobj__.tainted?.should be_false + end end end diff --git a/spec/ruby/library/delegate/delegator/untrust_spec.rb b/spec/ruby/library/delegate/delegator/untrust_spec.rb index b7f4bc823e..acc91b099a 100644 --- a/spec/ruby/library/delegate/delegator/untrust_spec.rb +++ b/spec/ruby/library/delegate/delegator/untrust_spec.rb @@ -6,18 +6,20 @@ describe "Delegator#untrust" do @delegate = DelegateSpecs::Delegator.new("") end - it "returns self" do - @delegate.untrust.equal?(@delegate).should be_true - end + ruby_version_is ''...'2.7' do + it "returns self" do + @delegate.untrust.equal?(@delegate).should be_true + end - it "untrusts the delegator" do - @delegate.__setobj__(nil) - @delegate.untrust - @delegate.untrusted?.should be_true - end + it "untrusts the delegator" do + @delegate.__setobj__(nil) + @delegate.untrust + @delegate.untrusted?.should be_true + end - it "untrusts the delegated object" do - @delegate.untrust - @delegate.__getobj__.untrusted?.should be_true + it "untrusts the delegated object" do + @delegate.untrust + @delegate.__getobj__.untrusted?.should be_true + end end end diff --git a/spec/ruby/library/pathname/new_spec.rb b/spec/ruby/library/pathname/new_spec.rb index f400444887..dcb770149f 100644 --- a/spec/ruby/library/pathname/new_spec.rb +++ b/spec/ruby/library/pathname/new_spec.rb @@ -10,9 +10,11 @@ describe "Pathname.new" do -> { Pathname.new("\0")}.should raise_error(ArgumentError) end - it "is tainted if path is tainted" do - path = '/usr/local/bin'.taint - Pathname.new(path).tainted?.should == true + ruby_version_is ''...'2.7' do + it "is tainted if path is tainted" do + path = '/usr/local/bin'.taint + Pathname.new(path).tainted?.should == true + end end it "raises a TypeError if not passed a String type" do diff --git a/spec/ruby/library/readline/history/delete_at_spec.rb b/spec/ruby/library/readline/history/delete_at_spec.rb index 8dcce259bb..c95a6a865e 100644 --- a/spec/ruby/library/readline/history/delete_at_spec.rb +++ b/spec/ruby/library/readline/history/delete_at_spec.rb @@ -35,11 +35,13 @@ with_feature :readline do -> { Readline::HISTORY.delete_at(-10) }.should raise_error(IndexError) end - it "taints the returned strings" do - Readline::HISTORY.push("1", "2", "3") - Readline::HISTORY.delete_at(0).tainted?.should be_true - Readline::HISTORY.delete_at(0).tainted?.should be_true - Readline::HISTORY.delete_at(0).tainted?.should be_true + ruby_version_is ''...'2.7' do + it "taints the returned strings" do + Readline::HISTORY.push("1", "2", "3") + Readline::HISTORY.delete_at(0).tainted?.should be_true + Readline::HISTORY.delete_at(0).tainted?.should be_true + Readline::HISTORY.delete_at(0).tainted?.should be_true + end end end end diff --git a/spec/ruby/library/readline/history/each_spec.rb b/spec/ruby/library/readline/history/each_spec.rb index 4b87df7640..23387bfc98 100644 --- a/spec/ruby/library/readline/history/each_spec.rb +++ b/spec/ruby/library/readline/history/each_spec.rb @@ -20,9 +20,11 @@ with_feature :readline do result.should == ["1", "2", "3"] end - it "yields tainted Objects" do - Readline::HISTORY.each do |x| - x.tainted?.should be_true + ruby_version_is ''...'2.7' do + it "yields tainted Objects" do + Readline::HISTORY.each do |x| + x.tainted?.should be_true + end end end end diff --git a/spec/ruby/library/readline/history/element_reference_spec.rb b/spec/ruby/library/readline/history/element_reference_spec.rb index 09cac5e28f..dfa5367cad 100644 --- a/spec/ruby/library/readline/history/element_reference_spec.rb +++ b/spec/ruby/library/readline/history/element_reference_spec.rb @@ -12,9 +12,11 @@ with_feature :readline do Readline::HISTORY.pop end - it "returns tainted objects" do - Readline::HISTORY[0].tainted?.should be_true - Readline::HISTORY[1].tainted?.should be_true + ruby_version_is ''...'2.7' do + it "returns tainted objects" do + Readline::HISTORY[0].tainted?.should be_true + Readline::HISTORY[1].tainted?.should be_true + end end it "returns the history item at the passed index" do diff --git a/spec/ruby/library/readline/history/pop_spec.rb b/spec/ruby/library/readline/history/pop_spec.rb index 3a4c3579d0..e17be666d8 100644 --- a/spec/ruby/library/readline/history/pop_spec.rb +++ b/spec/ruby/library/readline/history/pop_spec.rb @@ -20,11 +20,13 @@ with_feature :readline do Readline::HISTORY.size.should == 0 end - it "taints the returned strings" do - Readline::HISTORY.push("1", "2", "3") - Readline::HISTORY.pop.tainted?.should be_true - Readline::HISTORY.pop.tainted?.should be_true - Readline::HISTORY.pop.tainted?.should be_true + ruby_version_is ''...'2.7' do + it "taints the returned strings" do + Readline::HISTORY.push("1", "2", "3") + Readline::HISTORY.pop.tainted?.should be_true + Readline::HISTORY.pop.tainted?.should be_true + Readline::HISTORY.pop.tainted?.should be_true + end end end end diff --git a/spec/ruby/library/readline/history/shift_spec.rb b/spec/ruby/library/readline/history/shift_spec.rb index fdc637fc35..ccd90193fd 100644 --- a/spec/ruby/library/readline/history/shift_spec.rb +++ b/spec/ruby/library/readline/history/shift_spec.rb @@ -20,11 +20,13 @@ with_feature :readline do Readline::HISTORY.size.should == 0 end - it "taints the returned strings" do - Readline::HISTORY.push("1", "2", "3") - Readline::HISTORY.shift.tainted?.should be_true - Readline::HISTORY.shift.tainted?.should be_true - Readline::HISTORY.shift.tainted?.should be_true + ruby_version_is ''...'2.7' do + it "taints the returned strings" do + Readline::HISTORY.push("1", "2", "3") + Readline::HISTORY.shift.tainted?.should be_true + Readline::HISTORY.shift.tainted?.should be_true + Readline::HISTORY.shift.tainted?.should be_true + end end end end diff --git a/spec/ruby/library/readline/readline_spec.rb b/spec/ruby/library/readline/readline_spec.rb index f716d7b2df..24d2cbbe86 100644 --- a/spec/ruby/library/readline/readline_spec.rb +++ b/spec/ruby/library/readline/readline_spec.rb @@ -22,9 +22,11 @@ with_feature :readline do File.read(@out).should == "test" end - it "taints the returned strings" do - ruby_exe('File.write ARGV[0], Readline.readline.tainted?', @options) - File.read(@out).should == "true" + ruby_version_is ''...'2.7' do + it "taints the returned strings" do + ruby_exe('File.write ARGV[0], Readline.readline.tainted?', @options) + File.read(@out).should == "true" + end end end end 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 |