From 989b84ca889316f07ca965691056fbd306875ea5 Mon Sep 17 00:00:00 2001 From: Adam Daniels Date: Fri, 5 Mar 2021 20:35:16 -0500 Subject: [PATCH 1/2] Test --version and --help CLI flags --- test/standard/cli_test.rb | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/test/standard/cli_test.rb b/test/standard/cli_test.rb index c2570b83..461a9065 100644 --- a/test/standard/cli_test.rb +++ b/test/standard/cli_test.rb @@ -36,4 +36,24 @@ def test_unfixable_manually_fixed assert_empty fake_err.string assert_empty fake_out.string end + + def test_version + fake_out, fake_err, exit_code = do_with_fake_io { + Standard::Cli.new(["--version"]).run + } + + assert_equal 0, exit_code + assert_empty fake_err.string + refute_empty fake_out.string + end + + def test_help + fake_out, fake_err, exit_code = do_with_fake_io { + Standard::Cli.new(["--help"]).run + } + + assert_equal 0, exit_code + assert_empty fake_err.string + refute_empty fake_out.string + end end From d661ac07d923baf26c320b1f4ce26795672c8804 Mon Sep 17 00:00:00 2001 From: Adam Daniels Date: Fri, 5 Mar 2021 20:35:37 -0500 Subject: [PATCH 2/2] Cast runner return value to Integer --- lib/standard/cli.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/standard/cli.rb b/lib/standard/cli.rb index e3ad17dd..1c00e3cc 100644 --- a/lib/standard/cli.rb +++ b/lib/standard/cli.rb @@ -11,7 +11,7 @@ def initialize(argv) def run config = @builds_config.call(@argv) - @loads_runner.call(config.runner).call(config) + @loads_runner.call(config.runner).call(config).to_i end end end