diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2003-02-14 16:09:07 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2003-02-14 16:09:07 +0000 |
commit | f2d07eb82dd00174c15a10cd9a2e1bcdc0eb668e (patch) | |
tree | ad834634caf3a4f66d6ff165cf2518683594dc30 /sample/test.rb | |
parent | bfa0275833b60de39c8f890d6f47045d1ef4b26e (diff) |
* file.c (file_expand_path): fix surplus path separators while
expanding at root directory. [ruby-dev:19572]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3495 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'sample/test.rb')
-rw-r--r-- | sample/test.rb | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/sample/test.rb b/sample/test.rb index d20f204da0..7194e072b1 100644 --- a/sample/test.rb +++ b/sample/test.rb @@ -1671,6 +1671,19 @@ test_ok(File.dirname("a/b/c") == "a/b") test_ok(File.dirname("/a/b/c") == "/a/b") test_ok(File.dirname("/a/b/") == "/a") test_ok(File.dirname("/a/b///") == "/a") +case Dir.pwd +when %r'\A\w:' + test_ok(/\A\w:\/\z/ =~ File.expand_path(".", "/")) + test_ok(/\A\w:\/a\z/ =~ File.expand_path("a", "/")) +when %r'\A//' + test_ok(%r'\A//[^/]+/[^/]+\z' =~ File.expand_path(".", "/")) + test_ok(%r'\A//[^/]+/[^/]+/a\z' =~ File.expand_path(".", "/")) +else + test_ok(File.expand_path(".", "/") == "/") + test_ok(File.expand_path("sub", "/") == "/sub") +end +test_ok(File.expand_path(".", "//") == "//") +test_ok(File.expand_path("sub", "//") == "//sub") test_check "gc" begin |