Skip to content

Commit 2a98670

Browse files
byrooteregon
authored andcommitted
File.dirname: add spec for removal of repeated leading slashes
I discovered that surprising behavior while trying to optimize `File.dirname`.
1 parent ddcd042 commit 2a98670

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

core/file/dirname_spec.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,10 @@ def object.to_int; 2; end
7979
end
8080

8181
platform_is_not :windows do
82+
it "ignores repeated leading / (edge cases on non-windows)" do
83+
File.dirname("/////foo/bar/").should == "/foo"
84+
end
85+
8286
it "returns all the components of filename except the last one (edge cases on non-windows)" do
8387
File.dirname('/////').should == '/'
8488
File.dirname("//foo//").should == "/"

0 commit comments

Comments
 (0)