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

Test exit code in subcommand spec #15209

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
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: 5 additions & 1 deletion spec/primitives/external_command_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ describe Crystal::Command do
puts ENV["CRYSTAL"]?
puts PROGRAM_NAME
puts ARGV

exit 123
CRYSTAL

Process.run(ENV["CRYSTAL_SPEC_COMPILER_BIN"]? || "bin/crystal", ["build", source_file, "-o", path])
Expand All @@ -24,7 +26,9 @@ describe Crystal::Command do
)
output = process.output.gets_to_end
status = process.wait
status.success?.should be_true
status.normal_exit?.should be_true
status.exit_code.should eq 123

lines = output.lines
lines[0].should match /crystal/
lines[1].should match /crystal-external/
Expand Down
Loading