aboutsummaryrefslogtreecommitdiff
path: root/t/29-unit-sboremove.t
blob: a968dc7762ad9918c85df21aa557b378cf93e2a6 (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
#!/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.");
}