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

ruby-changes:44936

From: nobu <ko1@a...>
Date: Wed, 7 Dec 2016 11:19:34 +0900 (JST)
Subject: [ruby-changes:44936] nobu:r57009 (trunk): file.c: cygwin behavior

nobu	2016-12-07 11:19:29 +0900 (Wed, 07 Dec 2016)

  New Revision: 57009

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=57009

  Log:
    file.c: cygwin behavior
    
    * file.c: recent cygwin hides NTFS specific features.
      [ruby-core:78497] [Bug #13008]

  Modified files:
    trunk/file.c
    trunk/test/ruby/test_file_exhaustive.rb
Index: file.c
===================================================================
--- file.c	(revision 57008)
+++ file.c	(revision 57009)
@@ -2916,7 +2916,7 @@ static const char file_alt_separator[] = https://github.com/ruby/ruby/blob/trunk/file.c#L2916
 #endif
 
 #ifndef USE_NTFS
-#if defined _WIN32 || defined __CYGWIN__
+#if defined _WIN32
 #define USE_NTFS 1
 #else
 #define USE_NTFS 0
Index: test/ruby/test_file_exhaustive.rb
===================================================================
--- test/ruby/test_file_exhaustive.rb	(revision 57008)
+++ test/ruby/test_file_exhaustive.rb	(revision 57009)
@@ -7,7 +7,7 @@ require "socket" https://github.com/ruby/ruby/blob/trunk/test/ruby/test_file_exhaustive.rb#L7
 class TestFileExhaustive < Test::Unit::TestCase
   DRIVE = Dir.pwd[%r'\A(?:[a-z]:|//[^/]+/[^/]+)'i]
   POSIX = /cygwin|mswin|bccwin|mingw|emx/ !~ RUBY_PLATFORM
-  NTFS = !(/cygwin|mingw|mswin|bccwin/ !~ RUBY_PLATFORM)
+  NTFS = !(/mingw|mswin|bccwin/ !~ RUBY_PLATFORM)
 
   def assert_incompatible_encoding
     d = "\u{3042}\u{3044}".encode("utf-16le")
@@ -782,6 +782,8 @@ class TestFileExhaustive < Test::Unit::T https://github.com/ruby/ruby/blob/trunk/test/ruby/test_file_exhaustive.rb#L782
     a = "#{drive}/\225\\\\"
     if File::ALT_SEPARATOR == '\\'
       [%W"cp437 #{drive}/\225", %W"cp932 #{drive}/\225\\"]
+    elsif File.directory?("#{@dir}/\\")
+      [%W"cp437 /\225", %W"cp932 /\225\\"]
     else
       [["cp437", a], ["cp932", a]]
     end.each do |cp, expected|
@@ -1137,6 +1139,20 @@ class TestFileExhaustive < Test::Unit::T https://github.com/ruby/ruby/blob/trunk/test/ruby/test_file_exhaustive.rb#L1139
         assert_equal(basename, File.basename(file + ".", ".*"))
         assert_equal(basename, File.basename(file + "::$DATA", ".*"))
       end
+    else
+      [regular_file, utf8_file].each do |file|
+        basename = File.basename(file)
+        assert_equal(basename + " ", File.basename(file + " "))
+        assert_equal(basename + ".", File.basename(file + "."))
+        assert_equal(basename + "::$DATA", File.basename(file + "::$DATA"))
+        assert_equal(basename + " ", File.basename(file + " ", ".test"))
+        assert_equal(basename + ".", File.basename(file + ".", ".test"))
+        assert_equal(basename + "::$DATA", File.basename(file + "::$DATA", ".test"))
+        assert_equal(basename, File.basename(file + ".", ".*"))
+        basename.chomp!(".test")
+        assert_equal(basename, File.basename(file + " ", ".*"))
+        assert_equal(basename, File.basename(file + "::$DATA", ".*"))
+      end
     end
     if File::ALT_SEPARATOR == '\\'
       a = "foo/\225\\\\"

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

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