sbotools2

Maintenance fork of the original sbotools version 2
Log | Files | Refs | README

commit 387552dd73f03ffca070645660da72d50c485e3a
parent f41ca3d2f76ffc21ccba08033dca45202e461921
Author: Andreas Guldstrand <andreas.guldstrand@gmail.com>
Date:   Wed,  4 May 2016 01:13:25 +0200

19-unit.t: add test for get_src_dir

Diffstat:
Mt/19-unit.t | 12+++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/t/19-unit.t b/t/19-unit.t @@ -12,7 +12,7 @@ use SBO::Lib qw/ script_error usage_error open_fh %config indent get_installed_p use Capture::Tiny qw/ capture_merged /; use File::Temp 'tempdir'; -plan tests => 39; +plan tests => 40; # 1-2: test script_error(); { @@ -235,3 +235,13 @@ SKIP: { my $tmp = tempdir(CLEANUP => 1); is (SBO::Lib::revert_slackbuild("$tmp/foo"), 1, "revert_slackbuild() returned 1"); } + +# 40: test get_src_dir(); +SKIP: { + skip 'Test invalid if /foo-bar exists.', 1 if -e '/foo-bar'; + my $scalar = ''; + open(my $fh, '<', \$scalar) or skip "Could not open needed filehandle", 1; + + local $SBO::Lib::tmpd = "/foo-bar"; + is (scalar @{ SBO::Lib::get_src_dir($fh) }, 0, "get_src_dir() returned an empty array ref"); +}