diff options
| author | Andreas Guldstrand <andreas.guldstrand@gmail.com> | 2016-04-24 00:03:31 +0200 | 
|---|---|---|
| committer | Andreas Guldstrand <andreas.guldstrand@gmail.com> | 2016-04-24 00:03:31 +0200 | 
| commit | 20fc1d75ea897debdd93097de882a45dbf001796 (patch) | |
| tree | 97f547b6b26c240982632cda0880cc1153b8804a /t | |
| parent | befb838dd1a8144816ec7754dbc7ec5a5aa33882 (diff) | |
| download | sbotools2-20fc1d75ea897debdd93097de882a45dbf001796.tar.xz | |
t/19-unit.t: Add new tests for get_sbo_location(s)?
Diffstat (limited to 't')
| -rwxr-xr-x | t/19-unit.t | 18 | 
1 files changed, 16 insertions, 2 deletions
diff --git a/t/19-unit.t b/t/19-unit.t index 798a4ef..8d092f3 100755 --- a/t/19-unit.t +++ b/t/19-unit.t @@ -8,10 +8,10 @@ use Test::More;  use Test::Exit;  use FindBin '$RealBin';  use lib "$RealBin/../SBO-Lib/lib"; -use SBO::Lib qw/ script_error usage_error open_fh %config indent get_installed_packages /; +use SBO::Lib qw/ script_error usage_error open_fh %config indent get_installed_packages get_sbo_location get_sbo_locations /;  use Capture::Tiny qw/ capture_merged /; -plan tests => 30; +plan tests => 33;  # 1-2: test script_error();  { @@ -182,3 +182,17 @@ SKIP: {  	system(qw!rm -r /var/log/packages!);  	system(qw!mv /var/log/packages.backup /var/log/packages!);  } + +# 31-33: test get_sbo_location() and get_sbo_locations(); +{ +	my $exit; +	my $out = capture_merged { $exit = exit_code { get_sbo_location([]); }; }; + +	is ($exit, 2, 'get_sbo_location([]) exited with 2'); +	is ($out, "A fatal script error has occurred:\nget_sbo_location requires an argument.\nExiting.\n", 'get_sbo_location([]) gave correct output'); + +	local $config{LOCAL_OVERRIDES} = 'FALSE'; +	my %res = get_sbo_locations('nonexistentslackbuild'); + +	is (%res+0, 0, q"get_sbo_locations('nonexistentslackbuild') returned an empty hash"); +}  | 
