[前][次][番号順一覧][スレッド一覧]

ruby-changes:22289

From: nobu <ko1@a...>
Date: Thu, 19 Jan 2012 15:01:37 +0900 (JST)
Subject: [ruby-changes:22289] nobu:r34338 (trunk): * test/ruby/test_file_exhaustive.rb (test_expand_path): add tests for absolute paths and drive letters.

nobu	2012-01-19 15:01:29 +0900 (Thu, 19 Jan 2012)

  New Revision: 34338

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=34338

  Log:
    * test/ruby/test_file_exhaustive.rb (test_expand_path): add tests for absolute paths and drive letters.  [ruby-core:42177]

  Modified files:
    trunk/test/ruby/test_file_exhaustive.rb

Index: test/ruby/test_file_exhaustive.rb
===================================================================
--- test/ruby/test_file_exhaustive.rb	(revision 34337)
+++ test/ruby/test_file_exhaustive.rb	(revision 34338)
@@ -397,7 +397,15 @@
       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", "/") }

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]