summaryrefslogtreecommitdiff
path: root/test/ruby/test_file_exhaustive.rb
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-12-07 02:19:29 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-12-07 02:19:29 +0000
commit7eb8d74f34b9294e7da3d9f2db13e94503a3dd25 (patch)
tree3beb816ead9c15497a15fcc34084a9a76441a325 /test/ruby/test_file_exhaustive.rb
parent2201331de382a627dbf83dc255373372db5ac035 (diff)
downloadruby-7eb8d74f34b9294e7da3d9f2db13e94503a3dd25.tar.gz
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
Diffstat (limited to 'test/ruby/test_file_exhaustive.rb')
-rw-r--r--test/ruby/test_file_exhaustive.rb18
1 files changed, 17 insertions, 1 deletions
diff --git a/test/ruby/test_file_exhaustive.rb b/test/ruby/test_file_exhaustive.rb
index 2987910c32..49e695fc75 100644
--- a/test/ruby/test_file_exhaustive.rb
+++ b/test/ruby/test_file_exhaustive.rb
@@ -7,7 +7,7 @@ require "socket"
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::TestCase
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::TestCase
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\\\\"