File: remove.t

package info (click to toggle)
libdist-zilla-role-pluginbundle-pluginremover-perl 0.105-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, sid, trixie
  • size: 264 kB
  • sloc: perl: 287; makefile: 2
file content (56 lines) | stat: -rw-r--r-- 1,230 bytes parent folder | download | duplicates (3)
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# vim: set ts=2 sts=2 sw=2 expandtab smarttab:
use strict;
use warnings;
use Test::More 0.96;
use lib 't/lib';

my $mod = 'Dist::Zilla::Role::PluginBundle::PluginRemover';
eval "require $mod" or die $@;

use Dist::Zilla::Util;
sub e { Dist::Zilla::Util->expand_config_package_name($_[0]); }

my @plugins = (
  ['@Bundle/Foo' => e('Foo')],  # default name
  ['second Foo' => e('Foo')],   # custom name
  ['@Bundle/Bar' => e('Bar')],
  ['second Bar' => e('Bar')],
);

  is_deeply
    [ $mod->remove_plugins([qw(Baz)], @plugins) ],
    [ @plugins ],
    'nothing removed';

  is_deeply
    [ $mod->remove_plugins([qw(Foo)], @plugins) ],
    [
      ['@Bundle/Bar' => e('Bar')],
      ['second Bar' => e('Bar')],
    ],
    'all Foo removed';

  is_deeply
    [ $mod->remove_plugins([qw(Bar)], @plugins) ],
    [
      ['@Bundle/Foo' => e('Foo')],
      ['second Foo' => e('Foo')],
    ],
    'all Bar removed';

  is_deeply
    [ $mod->remove_plugins([qw(Bar Foo)], @plugins) ],
    [ ],
    'nothing left';

  is_deeply
    [ $mod->remove_plugins(['second Foo'], @plugins) ],
    [
      ['@Bundle/Foo' => e('Foo')],
      ['@Bundle/Bar' => e('Bar')],
      ['second Bar' => e('Bar')],
    ],
    'one Foo removed';


done_testing;