diff options
author | Jeremy Evans <code@jeremyevans.net> | 2019-09-24 20:59:12 -0700 |
---|---|---|
committer | Jeremy Evans <code@jeremyevans.net> | 2019-11-18 01:00:25 +0200 |
commit | ffd0820ab317542f8780aac475da590a4bdbc7a8 (patch) | |
tree | 6a5d774933c15fd2b9ea948bd3ae2fa587faaf82 /spec/ruby/library/readline | |
parent | c5c05460ac20abcbc0ed686eb4acf06da7a39a79 (diff) |
Deprecate taint/trust and related methods, and make the methods no-ops
This removes the related tests, and puts the related specs behind
version guards. This affects all code in lib, including some
libraries that may want to support older versions of Ruby.
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/2476
Diffstat (limited to 'spec/ruby/library/readline')
-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 |
6 files changed, 36 insertions, 24 deletions
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 |