From 47b13182518f63245dcb371b2b33aa106a7753f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johannes=20M=C3=BCller?= Date: Fri, 15 Nov 2024 14:12:30 +0100 Subject: [PATCH] Test exit code in subcommand spec --- spec/primitives/external_command_spec.cr | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/spec/primitives/external_command_spec.cr b/spec/primitives/external_command_spec.cr index 91687f7c2d21..e61c23c5cfcf 100644 --- a/spec/primitives/external_command_spec.cr +++ b/spec/primitives/external_command_spec.cr @@ -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]) @@ -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/