diff options
-rwxr-xr-x | t/01-unit.t | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/t/01-unit.t b/t/01-unit.t index 4c735dd..27932ee 100755 --- a/t/01-unit.t +++ b/t/01-unit.t @@ -11,7 +11,7 @@ use Capture::Tiny qw/ capture_merged /; use File::Temp 'tempdir'; use Cwd; -plan tests => 55; +plan tests => 59; # 1-2: test script_error(); { @@ -303,3 +303,22 @@ SKIP: { is ($res[1], undef, 'perform_sbo returned correct src'); is ($res[2], 6, 'perform_sbo returned correct exit'); } + +# 56-59: sboclean unit tests... +{ + local @ARGV = '-h'; + capture_merged { exit_code { do "$RealBin/../sboclean"; }; }; + + my $exit; + my $out = capture_merged { $exit = exit_code { main::rm_full(); }; }; + + is ($out, "A fatal script error has occurred:\nrm_full requires an argument.\nExiting.\n", 'rm_full() gave correct output'); + is ($exit, 2, 'rm_full() gave correct exit status'); + + undef $exit; + undef $out; + $out = capture_merged { $exit = exit_code { main::remove_stuff(); }; }; + + is ($out, "A fatal script error has occurred:\nremove_stuff requires an argument.\nExiting.\n", 'remove_stuff() gave correct output'); + is ($exit, 2, 'remove_stuff() gave correct exit status'); +} |