1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

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]
This commit is contained in:
Nobuyoshi Nakada 2019-10-17 14:42:38 +09:00
parent 2a261909cc
commit e169ad93f4
Notes: git 2019-10-17 18:52:16 +09:00
5 changed files with 30 additions and 10 deletions

View file

@ -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