summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNobuyoshi Nakada <[email protected]>2025-04-09 19:14:36 +0900
committerNobuyoshi Nakada <[email protected]>2025-04-09 19:14:36 +0900
commitce0d5cc06952317e8b0810ad978d6424f7ed9f6d ()
treee69ac26524a7c0cbca42c4ff7e41815c64fe0838
parent5cf7d948ad4b8b365092673d48e3be16fcf08a10 (diff)
Refine dirname test on Windows
- Compare with the root of the target file - Fix root path of UNC path
Notes: Merged: https://.com/ruby/ruby/pull/13090
-rw-r--r--test/ruby/test_file_exhaustive.rb8
1 files changed, 5 insertions, 3 deletions
@@ -6,7 +6,8 @@ require "socket"
require '-test-/file'
class TestFileExhaustive < Test::Unit::TestCase
- DRIVE = Dir.pwd[%r'\A(?:[a-z]:|//[^/]+/[^/]+)'i]
POSIX = /cygwin|mswin|bccwin|mingw|emx/ !~ RUBY_PLATFORM
NTFS = !(/mingw|mswin|bccwin/ !~ RUBY_PLATFORM)
@@ -1279,8 +1280,9 @@ class TestFileExhaustive < Test::Unit::TestCase
assert_equal(@dir, File.dirname(regular_file, 1))
assert_equal(File.dirname(@dir), File.dirname(regular_file, 2))
assert_raise(ArgumentError) {File.dirname(regular_file, -1)}
- # mswin allows rootdir and tmpdir are in different drives
- assert_equal(rootdir, File.dirname(regular_file, regular_file.count('/'))) unless /mswin/ =~ RUBY_PLATFORM
end
def test_dirname_encoding