sbotools2

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

25-unit-sbofind.t (1253B)


      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 => 6;
     15 
     16 # 1-6: sbofind unit tests...
     17 {
     18 	load('sbofind');
     19 
     20 	my $exit;
     21 	my $out = capture_merged { $exit = exit_code { main::perform_search(); }; };
     22 
     23 	is ($out, "A fatal script error has occurred:\nperform_search requires an argument.\nExiting.\n", "sbofind's perform_search() gave correct output");
     24 	is ($exit, 2, "sbofind's perform_search() gave correct exit status");
     25 
     26 	undef $exit;
     27 	$out = capture_merged { $exit = exit_code { main::get_file_contents(); }; };
     28 
     29 	is ($out, "A fatal script error has occurred:\nget_file_contents requires an argument.\nExiting.\n", "sbofind's get_file_contents() gave correct output");
     30 	is ($exit, 2, "sbofind's get_file_contents() gave correct exit status");
     31 
     32 	undef $exit;
     33 	$out = capture_merged { $exit = exit_code { main::show_build_queue(); }; };
     34 
     35 	is ($out, "A fatal script error has occurred:\nshow_build_queue requires an argument.\nExiting.\n", "sbofind's show_build_queue() gave correct output");
     36 	is ($exit, 2, "sbofind's show_build_queue() gave correct exit status");
     37 }