File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed
Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change 66require '-test-/file'
77
88class TestFileExhaustive < Test ::Unit ::TestCase
9- DRIVE = Dir . pwd [ %r'\A (?:[a-z]:|//[^/]+/[^/]+)'i ]
9+ ROOT_REGEXP = %r'\A (?:[a-z]:(?=(/))|//[^/]+/[^/]+)'i
10+ DRIVE = Dir . pwd [ ROOT_REGEXP ]
1011 POSIX = /cygwin|mswin|bccwin|mingw|emx/ !~ RUBY_PLATFORM
1112 NTFS = !( /mingw|mswin|bccwin/ !~ RUBY_PLATFORM )
1213
@@ -1279,8 +1280,9 @@ def test_dirname
12791280 assert_equal ( @dir , File . dirname ( regular_file , 1 ) )
12801281 assert_equal ( File . dirname ( @dir ) , File . dirname ( regular_file , 2 ) )
12811282 assert_raise ( ArgumentError ) { File . dirname ( regular_file , -1 ) }
1282- # mswin allows rootdir and tmpdir are in different drives
1283- assert_equal ( rootdir , File . dirname ( regular_file , regular_file . count ( '/' ) ) ) unless /mswin/ =~ RUBY_PLATFORM
1283+ root = "#{ @dir [ ROOT_REGEXP ] ||?/} #{ $1} "
1284+ assert_equal ( root , File . dirname ( regular_file , regular_file . count ( '/' ) ) )
1285+ assert_equal ( root , File . dirname ( regular_file , regular_file . count ( '/' ) + 100 ) )
12841286 end
12851287
12861288 def test_dirname_encoding
You can’t perform that action at this time.
0 commit comments