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
27 changes: 12 additions & 15 deletions spec/std/dir_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -230,15 +230,18 @@ describe "Dir" do
end

it "tests with relative path (starts with ..)" do
base_path = File.join("..", File.basename(Dir.current), "spec", "std", "data", "dir")
Dir["../#{File.basename(Dir.current)}/#{datapath}/dir/*/"].sort.should eq [
File.join(base_path, "dots", ""),
File.join(base_path, "subdir", ""),
File.join(base_path, "subdir2", ""),
].sort
Dir.cd(datapath) do
base_path = "../data/dir"
Dir["#{base_path}/*/"].sort.should eq [
File.join(base_path, "dots", ""),
File.join(base_path, "subdir", ""),
File.join(base_path, "subdir2", ""),
].sort
end
end

it "tests with relative path starting recursive" do
# TODO: This spec is broken on win32 because of `raise` weirdness on windows
pending_win32 "tests with relative path starting recursive" do
Dir["**/dir/*/"].sort.should eq [
datapath("dir", "dots", ""),
datapath("dir", "subdir", ""),
Expand Down Expand Up @@ -268,14 +271,8 @@ describe "Dir" do
Dir[""].should eq [] of String
end

it "root pattern" do
Dir["/"].should eq [
{% if flag?(:windows) %}
"C:\\"
{% else %}
"/"
{% end %},
]
pending_win32 "root pattern" do
Dir["/"].should eq ["/"]
end

it "pattern ending with .." do
Expand Down
Loading