summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-01-19 06:01:29 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-01-19 06:01:29 +0000
commit81d3b071b909bd3c8c00c5b2dc5b175113ca82a2 (patch)
treeac528810187401b9d7afb487c18fd56a91de1adb /test
parent1d794b933582604fd541479999bc7e3cc3bed0f0 (diff)
* test/ruby/test_file_exhaustive.rb (test_expand_path): add tests for absolute paths and drive letters. [ruby-core:42177]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34338 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_file_exhaustive.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/test/ruby/test_file_exhaustive.rb b/test/ruby/test_file_exhaustive.rb
index 1d45b97d9f..cd2760a72f 100644
--- a/test/ruby/test_file_exhaustive.rb
+++ b/test/ruby/test_file_exhaustive.rb
@@ -397,7 +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_equal('c:/bar/foo', File.expand_path('c:foo', 'c:/bar'))
+ assert_equal('C:/bar/foo', File.expand_path('c:foo', 'C:/bar'))
end
+ if drive = Dir.pwd[%r'\A(?:[a-z]:|//[^/]+/[^/]+)'i]
+ assert_equal("z:/foo", File.expand_path('/foo', "z:/bar"))
+ assert_equal("//host/share/foo", File.expand_path('/foo', "//host/share/bar"))
+ end
+ assert_equal("#{drive}/foo", File.expand_path('/foo'))
assert_kind_of(String, File.expand_path("~")) if ENV["HOME"]
assert_raise(ArgumentError) { File.expand_path("~foo_bar_baz_unknown_user_wahaha") }
assert_raise(ArgumentError) { File.expand_path("~foo_bar_baz_unknown_user_wahaha", "/") }