diff options
author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2019-10-17 14:42:38 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2019-10-17 18:51:51 +0900 |
commit | e169ad93f44e1944ecf7bb65133fd34e8b868ea8 (patch) | |
tree | 82c3badab1865e5036dd054dcb15b7fdc3f7c61e /test/ruby/test_file_exhaustive.rb | |
parent | 2a261909cc6d0767d584c0555a1c6594aacf567a (diff) | |
download | ruby-e169ad93f44e1944ecf7bb65133fd34e8b868ea8.tar.gz |
Fixed File.extname at a name ending with a dot
File.extname now returns a dot string at a name ending with a dot.
[Bug #15267]
Diffstat (limited to 'test/ruby/test_file_exhaustive.rb')
-rw-r--r-- | test/ruby/test_file_exhaustive.rb | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/test/ruby/test_file_exhaustive.rb b/test/ruby/test_file_exhaustive.rb index 6b80b82389..4bb5479303 100644 --- a/test/ruby/test_file_exhaustive.rb +++ b/test/ruby/test_file_exhaustive.rb @@ -1308,21 +1308,23 @@ class TestFileExhaustive < Test::Unit::TestCase assert_equal(".test", File.extname(regular_file)) assert_equal(".test", File.extname(utf8_file)) prefixes = ["", "/", ".", "/.", "bar/.", "/bar/."] - infixes = ["", " ", "."] + infixes = ["", " "] infixes2 = infixes + [".ext "] appendixes = [""] if NTFS appendixes << " " << "." << "::$DATA" << "::$DATA.bar" + else + appendixes << [".", "."] end prefixes.each do |prefix| - appendixes.each do |appendix| + appendixes.each do |appendix, ext = ""| infixes.each do |infix| path = "#{prefix}foo#{infix}#{appendix}" - assert_equal("", File.extname(path), "File.extname(#{path.inspect})") + assert_equal(ext, File.extname(path), "File.extname(#{path.inspect})") end infixes2.each do |infix| path = "#{prefix}foo#{infix}.ext#{appendix}" - assert_equal(".ext", File.extname(path), "File.extname(#{path.inspect})") + assert_equal(ext.empty? ? ".ext" : appendix, File.extname(path), "File.extname(#{path.inspect})") end end end |