summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2019-10-17 14:42:38 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2019-10-17 18:51:51 +0900
commite169ad93f44e1944ecf7bb65133fd34e8b868ea8 (patch)
tree82c3badab1865e5036dd054dcb15b7fdc3f7c61e /spec
parent2a261909cc6d0767d584c0555a1c6594aacf567a (diff)
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]
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/2565
Diffstat (limited to 'spec')
-rw-r--r--spec/ruby/core/file/extname_spec.rb10
1 files changed, 8 insertions, 2 deletions
diff --git a/spec/ruby/core/file/extname_spec.rb b/spec/ruby/core/file/extname_spec.rb
index 358690b44a..3b7fa5a128 100644
--- a/spec/ruby/core/file/extname_spec.rb
+++ b/spec/ruby/core/file/extname_spec.rb
@@ -20,8 +20,14 @@ describe "File.extname" do
File.extname("..").should == ""
File.extname("...").should == ""
File.extname("....").should == ""
- File.extname(".foo.").should == ""
- File.extname("foo.").should == ""
+ guard -> { platform_is :windows or ruby_version_is ""..."2.7" } do
+ File.extname(".foo.").should == ""
+ File.extname("foo.").should == ""
+ end
+ guard -> { platform_is_not :windows and ruby_version_is "2.7" } do
+ File.extname(".foo.").should == "."
+ File.extname("foo.").should == "."
+ end
end
it "returns only the last extension of a file with several dots" do