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 /test/ruby/test_file_exhaustive.rb | |
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 'test/ruby/test_file_exhaustive.rb')
-rw-r--r-- | test/ruby/test_file_exhaustive.rb | 44 |
1 files changed, 0 insertions, 44 deletions
diff --git a/test/ruby/test_file_exhaustive.rb b/test/ruby/test_file_exhaustive.rb index 4bb5479303..b96b727349 100644 --- a/test/ruby/test_file_exhaustive.rb +++ b/test/ruby/test_file_exhaustive.rb @@ -187,24 +187,6 @@ class TestFileExhaustive < Test::Unit::TestCase end end - def test_path_taint - [regular_file, utf8_file].each do |file| - file.untaint - assert_equal(false, File.open(file) {|f| f.path}.tainted?) - assert_equal(true, File.open(file.dup.taint) {|f| f.path}.tainted?) - o = Object.new - class << o; self; end.class_eval do - define_method(:to_path) { file } - end - assert_equal(false, File.open(o) {|f| f.path}.tainted?) - class << o; self; end.class_eval do - remove_method(:to_path) - define_method(:to_path) { file.dup.taint } - end - assert_equal(true, File.open(o) {|f| f.path}.tainted?) - end - end - def assert_integer(n) assert_kind_of(Integer, n) end @@ -1077,32 +1059,6 @@ class TestFileExhaustive < Test::Unit::TestCase assert_match(%r"\A#{DRIVE}/foo\z"i, File.expand_path('/foo')) end - def test_expand_path_returns_tainted_strings_or_not - assert_equal(true, File.expand_path('foo').tainted?) - assert_equal(true, File.expand_path('foo'.taint).tainted?) - assert_equal(true, File.expand_path('/foo'.taint).tainted?) - assert_equal(true, File.expand_path('foo', 'bar').tainted?) - assert_equal(true, File.expand_path('foo', '/bar'.taint).tainted?) - assert_equal(true, File.expand_path('foo'.taint, '/bar').tainted?) - assert_equal(true, File.expand_path('~').tainted?) if ENV["HOME"] - - if DRIVE - assert_equal(true, File.expand_path('/foo').tainted?) - assert_equal(false, File.expand_path('//foo').tainted?) - assert_equal(true, File.expand_path('C:/foo'.taint).tainted?) - assert_equal(false, File.expand_path('C:/foo').tainted?) - assert_equal(true, File.expand_path('foo', '/bar').tainted?) - assert_equal(true, File.expand_path('foo', 'C:/bar'.taint).tainted?) - assert_equal(true, File.expand_path('foo'.taint, 'C:/bar').tainted?) - assert_equal(false, File.expand_path('foo', 'C:/bar').tainted?) - assert_equal(false, File.expand_path('C:/foo/../bar').tainted?) - assert_equal(false, File.expand_path('foo', '//bar').tainted?) - else - assert_equal(false, File.expand_path('/foo').tainted?) - assert_equal(false, File.expand_path('foo', '/bar').tainted?) - end - end - def test_expand_path_converts_a_pathname_to_an_absolute_pathname_using_home_as_base old_home = ENV["HOME"] home = ENV["HOME"] = "#{DRIVE}/UserHome" |