aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Guldstrand <andreas.guldstrand@gmail.com>2016-05-05 23:42:25 +0200
committerAndreas Guldstrand <andreas.guldstrand@gmail.com>2016-05-05 23:42:25 +0200
commitade98d66ea8004aa8eb85459095e3b41b2c8dfc3 (patch)
treecd9d807d394e85c46dcea8e4e4a40f54030c968c
parent3c3e097a8175744053d33ef78e7b9147c198e93c (diff)
downloadsbotools2-ade98d66ea8004aa8eb85459095e3b41b2c8dfc3.tar.xz
19-unit.t: test user_prompt() with undef location
-rwxr-xr-xt/19-unit.t13
1 files changed, 11 insertions, 2 deletions
diff --git a/t/19-unit.t b/t/19-unit.t
index 576403f..ba45663 100755
--- a/t/19-unit.t
+++ b/t/19-unit.t
@@ -8,11 +8,11 @@ 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 get_sbo_location get_sbo_locations get_local_outdated_versions get_readme_contents /;
+use SBO::Lib qw/ script_error usage_error open_fh %config indent get_installed_packages get_sbo_location get_sbo_locations get_local_outdated_versions get_readme_contents user_prompt /;
use Capture::Tiny qw/ capture_merged /;
use File::Temp 'tempdir';
-plan tests => 42;
+plan tests => 44;
# 1-2: test script_error();
{
@@ -252,3 +252,12 @@ SKIP: {
is ($ret[0], undef, "get_readme_contents() returned undef");
is ($ret[1], 6, "get_readme_contents() returned 6");
}
+
+# 43-44: test user_prompt();
+{
+ my $exit;
+ my $out = capture_merged { $exit = exit_code { user_prompt('foo', undef); }; };
+
+ is ($exit, 1, 'user_prompt() exited with 1');
+ is ($out, "Unable to locate foo in the SlackBuilds.org tree.\n", 'user_prompt() gave correct output');
+}