diff options
author | Benoit Daloze <eregontp@gmail.com> | 2019-10-26 20:53:01 +0200 |
---|---|---|
committer | Benoit Daloze <eregontp@gmail.com> | 2019-10-26 20:53:01 +0200 |
commit | 664e96b1de816c813c29f61e16a2031a7af7ba86 (patch) | |
tree | 7f4691847cd6b3282812eea7e2be3758e08d1433 /spec/ruby/core/file | |
parent | 3eb0d50c0baae916f4486c264605b18e77bee0dc (diff) | |
download | ruby-664e96b1de816c813c29f61e16a2031a7af7ba86.tar.gz |
Update to ruby/spec@28a728b
Diffstat (limited to 'spec/ruby/core/file')
-rw-r--r-- | spec/ruby/core/file/extname_spec.rb | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/spec/ruby/core/file/extname_spec.rb b/spec/ruby/core/file/extname_spec.rb index 3b7fa5a128..e9b53bc24d 100644 --- a/spec/ruby/core/file/extname_spec.rb +++ b/spec/ruby/core/file/extname_spec.rb @@ -2,7 +2,7 @@ require_relative '../../spec_helper' describe "File.extname" do - it "returns the extension (the portion of file name in path after the period)." do + it "returns the extension (the portion of file name in path after the period)" do File.extname("foo.rb").should == ".rb" File.extname("/foo/bar.rb").should == ".rb" File.extname("/foo.rb/bar.c").should == ".c" @@ -12,7 +12,7 @@ describe "File.extname" do File.extname(".app.conf").should == ".conf" end - it "returns the extension (the portion of file name in path after the period).(edge cases)" do + it "returns the extension for edge cases" do File.extname("").should == "" File.extname(".").should == "" File.extname("/").should == "" @@ -20,13 +20,21 @@ describe "File.extname" do File.extname("..").should == "" File.extname("...").should == "" File.extname("....").should == "" + end + + describe "for a filename ending with a dot" do guard -> { platform_is :windows or ruby_version_is ""..."2.7" } do - File.extname(".foo.").should == "" - File.extname("foo.").should == "" + it "returns ''" do + File.extname(".foo.").should == "" + File.extname("foo.").should == "" + end end + guard -> { platform_is_not :windows and ruby_version_is "2.7" } do - File.extname(".foo.").should == "." - File.extname("foo.").should == "." + it "returns '.'" do + File.extname(".foo.").should == "." + File.extname("foo.").should == "." + end end end |