aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorNAKAMURA Usaku <usa@ruby-lang.org>2019-12-22 02:36:55 +0900
committerNAKAMURA Usaku <usa@ruby-lang.org>2019-12-22 02:42:09 +0900
commit61aff0cd189e67fa6f2565639ad0128fa33b88fc (patch)
treec1aaf72ca72f4f0e0f98655aef940299b1091ddc /test
parent29ea228efc5af08a0e91fafe155617f20e22976b (diff)
downloadruby-61aff0cd189e67fa6f2565639ad0128fa33b88fc.tar.gz
Should return "." for File.extname("file.") also on Windows
But not changes another cases, such as "file.rb." [Bug #15267]
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_file_exhaustive.rb6
-rw-r--r--test/ruby/test_path.rb6
2 files changed, 4 insertions, 8 deletions
diff --git a/test/ruby/test_file_exhaustive.rb b/test/ruby/test_file_exhaustive.rb
index 975bcb6bc2..de4c21e5ca 100644
--- a/test/ruby/test_file_exhaustive.rb
+++ b/test/ruby/test_file_exhaustive.rb
@@ -1268,19 +1268,19 @@ class TestFileExhaustive < Test::Unit::TestCase
infixes2 = infixes + [".ext "]
appendixes = [""]
if NTFS
- appendixes << " " << "." << "::$DATA" << "::$DATA.bar"
+ appendixes << " " << [".", ".", ""] << "::$DATA" << "::$DATA.bar"
else
appendixes << [".", "."]
end
prefixes.each do |prefix|
- appendixes.each do |appendix, ext = ""|
+ appendixes.each do |appendix, ext = "", ext2 = ext|
infixes.each do |infix|
path = "#{prefix}foo#{infix}#{appendix}"
assert_equal(ext, File.extname(path), "File.extname(#{path.inspect})")
end
infixes2.each do |infix|
path = "#{prefix}foo#{infix}.ext#{appendix}"
- assert_equal(ext.empty? ? ".ext" : appendix, File.extname(path), "File.extname(#{path.inspect})")
+ assert_equal(ext2.empty? ? ".ext" : appendix, File.extname(path), "File.extname(#{path.inspect})")
end
end
end
diff --git a/test/ruby/test_path.rb b/test/ruby/test_path.rb
index b35e942a2a..64111ee805 100644
--- a/test/ruby/test_path.rb
+++ b/test/ruby/test_path.rb
@@ -239,11 +239,7 @@ class TestPath < Test::Unit::TestCase
ext = '.'
end
assert_equal(ext, File.extname('a.rb.'))
- if /mswin|bccwin|mingw/ =~ RUBY_PLATFORM
- # trailing spaces and dots are ignored on NTFS.
- ext = ''
- end
- assert_equal(ext, File.extname('a.'))
+ assert_equal('.', File.extname('a.'))
assert_equal('', File.extname('.x'))
assert_equal('', File.extname('..x'))
end