sbotools2

Maintenance fork of the original sbotools version 2
git clone git://git.server.ky/slackcoder/sbotools2
Log | Files | Refs | README

23-unit-sboclean.t (904B)


      1 #!/usr/bin/env perl
      2 
      3 use strict;
      4 use warnings;
      5 use Test::More;
      6 use Test::Exit;
      7 use FindBin '$RealBin';
      8 use lib $RealBin;
      9 use Test::Sbotools qw/ load /;
     10 use Capture::Tiny qw/ capture_merged /;
     11 use File::Temp 'tempdir';
     12 use Cwd;
     13 
     14 plan tests => 4;
     15 
     16 # 1-4: sboclean unit tests...
     17 {
     18 	load('sboclean');
     19 
     20 	my $exit;
     21 	my $out = capture_merged { $exit = exit_code { main::rm_full(); }; };
     22 
     23 	is ($out, "A fatal script error has occurred:\nrm_full requires an argument.\nExiting.\n", "sboclean's rm_full() gave correct output");
     24 	is ($exit, 2, "sboclean's rm_full() gave correct exit status");
     25 
     26 	undef $exit;
     27 	undef $out;
     28 	$out = capture_merged { $exit = exit_code { main::remove_stuff(); }; };
     29 
     30 	is ($out, "A fatal script error has occurred:\nremove_stuff requires an argument.\nExiting.\n", "sboclean's remove_stuff() gave correct output");
     31 	is ($exit, 2, "sboclean's remove_stuff() gave correct exit status");
     32 }