diff options
author | Andreas Guldstrand <andreas.guldstrand@gmail.com> | 2016-08-31 00:27:14 +0200 |
---|---|---|
committer | Andreas Guldstrand <andreas.guldstrand@gmail.com> | 2016-08-31 00:27:14 +0200 |
commit | e709693ca2107f99fc69fcc11d2b5d6b99bd0a3a (patch) | |
tree | 10a1281b2d02a51fefe319692621a9dff17d74aa /t | |
parent | 1487aaecb1db46315bd267854f71de985caafda7 (diff) | |
download | sbotools2-e709693ca2107f99fc69fcc11d2b5d6b99bd0a3a.tar.xz |
29-unit-sboremove.t: unit test for sboremove
Diffstat (limited to 't')
-rwxr-xr-x | t/29-unit-sboremove.t | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/t/29-unit-sboremove.t b/t/29-unit-sboremove.t new file mode 100755 index 0000000..a968dc7 --- /dev/null +++ b/t/29-unit-sboremove.t @@ -0,0 +1,35 @@ +#!/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 => 1; + +# 1: sboremove unit test... +{ + load('sboremove'); + + no warnings 'redefine', 'once'; + + my $sentinel = 0; + local *main::in = sub { + my $find = shift; + my @ret = grep { $find eq $_ } @_; + $sentinel++ if @ret; + return 1 if @ret; + return 0; + }; + + main::confirm_remove('foo'); + main::confirm_remove('foo'); + + is ($sentinel, 1, "confirm_remove() checks for duplicates."); +} |