summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-02-09 02:23:16 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-02-09 02:23:16 +0000
commit8b322b5cf6d21e9e72e06e6172d3ac6c4b4ca8e1 (patch)
tree38cdfd3cdc8ebb219da6c940dd07cd12f0bf202f /test
parent6b3ba6912a2a7aec19b58327f460ec46880724a9 (diff)
merge revision(s) 34338-34340: [Backport #5909]
* test/ruby/test_file_exhaustive.rb (test_expand_path): add tests for absolute paths and drive letters. [ruby-core:42177] * test/ruby/test_file_exhaustive.rb (test_expand_path): ignore case of paths on DOSISH platforms. * test/ruby/test_file_exhaustive.rb (test_expand_path): fix commit miss, removed surplus downcase. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@34503 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_file_exhaustive.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/ruby/test_file_exhaustive.rb b/test/ruby/test_file_exhaustive.rb
index 1d45b97d9f..c10b05a86b 100644
--- a/test/ruby/test_file_exhaustive.rb
+++ b/test/ruby/test_file_exhaustive.rb
@@ -397,6 +397,15 @@ class TestFileExhaustive < Test::Unit::TestCase
assert_equal(@file, File.expand_path(@file + "."))
assert_equal(@file, File.expand_path(@file + "::$DATA"))
assert_match(/\Ac:\//i, File.expand_path('c:'), '[ruby-core:31591]')
+ assert_match(/\Ac:\//i, File.expand_path('c:foo', 'd:/bar'))
+ assert_match(%r'\Ac:/bar/foo\z'i, File.expand_path('c:foo', 'c:/bar'))
+ end
+ if drive = Dir.pwd[%r'\A(?:[a-z]:|//[^/]+/[^/]+)'i]
+ assert_match(%r"\Az:/foo\z"i, File.expand_path('/foo', "z:/bar"))
+ assert_match(%r"\A//host/share/foo\z"i, File.expand_path('/foo', "//host/share/bar"))
+ assert_match(%r"\A#{drive}/foo\z"i, File.expand_path('/foo'))
+ else
+ assert_equal("/foo", File.expand_path('/foo'))
end
assert_kind_of(String, File.expand_path("~")) if ENV["HOME"]
assert_raise(ArgumentError) { File.expand_path("~foo_bar_baz_unknown_user_wahaha") }