From 60566d329892360618457243ecba28243ca590ac Mon Sep 17 00:00:00 2001 From: nobu Date: Fri, 14 Feb 2003 16:09:07 +0000 Subject: * file.c (file_expand_path): fix surplus path separators while expanding at root directory. [ruby-dev:19572] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@3495 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- sample/test.rb | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'sample') diff --git a/sample/test.rb b/sample/test.rb index d20f204da..7194e072b 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 -- cgit