Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify expectation of loader spec error messages #12858

Merged
Merged
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
6 changes: 4 additions & 2 deletions spec/compiler/loader/unix_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,14 @@ describe Crystal::Loader do
end

it "parses file paths" do
expect_raises(Crystal::Loader::LoadError, /#{Dir.current}\/foobar\.o.+(No such file or directory|image not found|no such file)|Cannot open "#{Dir.current}\/foobar\.o"/) do
exc = expect_raises(Crystal::Loader::LoadError, /no such file|image not found|cannot open/i) do
Crystal::Loader.parse(["foobar.o"], search_paths: [] of String)
end
expect_raises(Crystal::Loader::LoadError, /(#{Dir.current}\/foo\/bar\.o).+(No such file or directory|image not found|no such file)|Cannot open "#{Dir.current}\/foo\/bar\.o"/) do
exc.message.should contain File.join(Dir.current, "foobar.o")
exc = expect_raises(Crystal::Loader::LoadError, /no such file|image not found|cannot open/i) do
Crystal::Loader.parse(["-l", "foo/bar.o"], search_paths: [] of String)
end
exc.message.should contain File.join(Dir.current, "foo", "bar.o")
end
end

Expand Down