Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions spec/std/file_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -564,17 +564,17 @@ describe "File" do
File.expand_path("../bin", "x/../tmp").should eq(File.join([base, "bin"]))
end

pending_win32 "expand_path for commoms unix path give a full path" do
File.expand_path("/tmp/").should eq("/tmp")
it "expand_path for commoms unix path give a full path" do
File.expand_path("/tmp/").should eq("/tmp/")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Surely all the specs on file that deal with pure paths should be moved to path_spec. We needn't spec the Path wrapper and Path.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wanted to leave it in until it gets completely replaced. This way it's easy to see that the behaviour is mostly the same except for a few details.

File.expand_path("/tmp/../../../tmp").should eq("/tmp")
File.expand_path("").should eq(base)
File.expand_path("./////").should eq(base)
File.expand_path("./////").should eq(File.join(base, ""))
File.expand_path(".").should eq(base)
File.expand_path(base).should eq(base)
end

pending_win32 "converts a pathname to an absolute pathname, using ~ (home) as base" do
File.expand_path("~/").should eq(home)
it "converts a pathname to an absolute pathname, using ~ (home) as base" do
File.expand_path("~/").should eq(File.join(home, ""))
File.expand_path("~/..badfilename").should eq(File.join(home, "..badfilename"))
File.expand_path("..").should eq("/#{base.split('/')[0...-1].join('/')}".gsub(%r{\A//}, "/"))
File.expand_path("~/a", "~/b").should eq(File.join(home, "a"))
Expand All @@ -583,11 +583,11 @@ describe "File" do
File.expand_path("~/a", "/tmp/gumby/ddd").should eq(File.join([home, "a"]))
end

pending_win32 "converts a pathname to an absolute pathname, using ~ (home) as base (trailing /)" do
it "converts a pathname to an absolute pathname, using ~ (home) as base (trailing /)" do
prev_home = home
begin
ENV["HOME"] = File.expand_path(datapath)
File.expand_path("~/").should eq(home)
File.expand_path("~/").should eq(File.join(home, ""))
File.expand_path("~/..badfilename").should eq(File.join(home, "..badfilename"))
File.expand_path("..").should eq("/#{base.split('/')[0...-1].join('/')}".gsub(%r{\A//}, "/"))
File.expand_path("~/a", "~/b").should eq(File.join(home, "a"))
Expand All @@ -599,13 +599,13 @@ describe "File" do
end
end

pending_win32 "converts a pathname to an absolute pathname, using ~ (home) as base (HOME=/)" do
it "converts a pathname to an absolute pathname, using ~ (home) as base (HOME=/)" do
prev_home = home
begin
ENV["HOME"] = "/"
File.expand_path("~/").should eq(home)
File.expand_path("~/..badfilename").should eq(File.join(home, "..badfilename"))
File.expand_path("..").should eq("/#{base.split('/')[0...-1].join('/')}".gsub(%r{\A//}, "/"))
File.expand_path("..").should eq("/#{base.split('/')[0...-1].join('/')}".gsub(/\A\/\//, "/"))
File.expand_path("~/a", "~/b").should eq(File.join(home, "a"))
File.expand_path("~").should eq(home)
File.expand_path("~", "/tmp/gumby/ddd").should eq(home)
Expand Down
Loading