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 /spec/ruby | |
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 'spec/ruby')
-rw-r--r-- | spec/ruby/core/file/extname_spec.rb | 10 |
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 |