aboutsummaryrefslogtreecommitdiff
path: root/t/25-unit-sbofind.t
blob: c636e1b13b70886c7b37932e8def87c883515084 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/usr/bin/env perl

use strict;
use warnings;
use Test::More;
use Test::Exit;
use FindBin '$RealBin';
use lib $RealBin;
use Test::Sbotools qw/ load /;
use Capture::Tiny qw/ capture_merged /;
use File::Temp 'tempdir';
use Cwd;

plan tests => 6;

# 1-6: sbofind unit tests...
{
	load('sbofind');

	my $exit;
	my $out = capture_merged { $exit = exit_code { main::perform_search(); }; };

	is ($out, "A fatal script error has occurred:\nperform_search requires an argument.\nExiting.\n", "sbofind's perform_search() gave correct output");
	is ($exit, 2, "sbofind's perform_search() gave correct exit status");

	undef $exit;
	$out = capture_merged { $exit = exit_code { main::get_file_contents(); }; };

	is ($out, "A fatal script error has occurred:\nget_file_contents requires an argument.\nExiting.\n", "sbofind's get_file_contents() gave correct output");
	is ($exit, 2, "sbofind's get_file_contents() gave correct exit status");

	undef $exit;
	$out = capture_merged { $exit = exit_code { main::show_build_queue(); }; };

	is ($out, "A fatal script error has occurred:\nshow_build_queue requires an argument.\nExiting.\n", "sbofind's show_build_queue() gave correct output");
	is ($exit, 2, "sbofind's show_build_queue() gave correct exit status");
}