mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
file.c: cygwin behavior
* file.c: recent cygwin hides NTFS specific features. [ruby-core:78497] [Bug #13008] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57009 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
2201331de3
commit
7eb8d74f34
2 changed files with 18 additions and 2 deletions
2
file.c
2
file.c
|
@ -2916,7 +2916,7 @@ static const char file_alt_separator[] = {FILE_ALT_SEPARATOR, '\0'};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef USE_NTFS
|
#ifndef USE_NTFS
|
||||||
#if defined _WIN32 || defined __CYGWIN__
|
#if defined _WIN32
|
||||||
#define USE_NTFS 1
|
#define USE_NTFS 1
|
||||||
#else
|
#else
|
||||||
#define USE_NTFS 0
|
#define USE_NTFS 0
|
||||||
|
|
|
@ -7,7 +7,7 @@ require "socket"
|
||||||
class TestFileExhaustive < Test::Unit::TestCase
|
class TestFileExhaustive < Test::Unit::TestCase
|
||||||
DRIVE = Dir.pwd[%r'\A(?:[a-z]:|//[^/]+/[^/]+)'i]
|
DRIVE = Dir.pwd[%r'\A(?:[a-z]:|//[^/]+/[^/]+)'i]
|
||||||
POSIX = /cygwin|mswin|bccwin|mingw|emx/ !~ RUBY_PLATFORM
|
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
|
def assert_incompatible_encoding
|
||||||
d = "\u{3042}\u{3044}".encode("utf-16le")
|
d = "\u{3042}\u{3044}".encode("utf-16le")
|
||||||
|
@ -782,6 +782,8 @@ class TestFileExhaustive < Test::Unit::TestCase
|
||||||
a = "#{drive}/\225\\\\"
|
a = "#{drive}/\225\\\\"
|
||||||
if File::ALT_SEPARATOR == '\\'
|
if File::ALT_SEPARATOR == '\\'
|
||||||
[%W"cp437 #{drive}/\225", %W"cp932 #{drive}/\225\\"]
|
[%W"cp437 #{drive}/\225", %W"cp932 #{drive}/\225\\"]
|
||||||
|
elsif File.directory?("#{@dir}/\\")
|
||||||
|
[%W"cp437 /\225", %W"cp932 /\225\\"]
|
||||||
else
|
else
|
||||||
[["cp437", a], ["cp932", a]]
|
[["cp437", a], ["cp932", a]]
|
||||||
end.each do |cp, expected|
|
end.each do |cp, expected|
|
||||||
|
@ -1137,6 +1139,20 @@ class TestFileExhaustive < Test::Unit::TestCase
|
||||||
assert_equal(basename, File.basename(file + ".", ".*"))
|
assert_equal(basename, File.basename(file + ".", ".*"))
|
||||||
assert_equal(basename, File.basename(file + "::$DATA", ".*"))
|
assert_equal(basename, File.basename(file + "::$DATA", ".*"))
|
||||||
end
|
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
|
end
|
||||||
if File::ALT_SEPARATOR == '\\'
|
if File::ALT_SEPARATOR == '\\'
|
||||||
a = "foo/\225\\\\"
|
a = "foo/\225\\\\"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue