File: except.t

package info (click to toggle)
libnamespace-autoclean-perl 0.31-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 520 kB
  • sloc: perl: 580; makefile: 2
file content (36 lines) | stat: -rw-r--r-- 833 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
use strict;
use warnings;

use Test::More 0.88;

{
    package Foo;
    use Scalar::Util qw(blessed);
    sub mysub { }
    use namespace::autoclean -except => ['blessed'];
}

ok( Foo->can('mysub'), 'Foo has mysub method' );
ok( Foo->can('blessed'), 'Foo has blessed sub - passed to -except as arrayref' );

{
    package Bar;
    use Scalar::Util qw(blessed);
    sub mysub { }
    use namespace::autoclean -except => 'blessed';
}

ok( Bar->can('mysub'), 'Bar has mysub method' );
ok( Bar->can('blessed'), 'Bar has blessed sub - passed to -except as string' );

{
    package Baz;
    use Scalar::Util qw(blessed);
    sub mysub { }
    use namespace::autoclean -except => qr/bless/;
}

ok( Baz->can('mysub'), 'Baz has mysub method' );
ok( Baz->can('blessed'), 'Baz has blessed sub - passed to -except as regex' );

done_testing();