From e169ad93f44e1944ecf7bb65133fd34e8b868ea8 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Thu, 17 Oct 2019 14:42:38 +0900 Subject: 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] --- spec/ruby/core/file/extname_spec.rb | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'spec/ruby') 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 -- cgit v1.2.3