File: Subclass.pm

package info (click to toggle)
libchi-perl 0.58-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 660 kB
  • ctags: 421
  • sloc: perl: 5,496; makefile: 2
file content (35 lines) | stat: -rw-r--r-- 832 bytes parent folder | download
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
package CHI::t::Subclass;
{
  $CHI::t::Subclass::VERSION = '0.58';
}
use strict;
use warnings;
use CHI::Test;
use base qw(CHI::Test::Class);

# Test declare_unsupported_methods
#
{
    package CHI::t::Subclass::Driver::HasUnsupported;
{
  $CHI::t::Subclass::Driver::HasUnsupported::VERSION = '0.58';
}
    use Moo;
    extends 'CHI::Driver::Memory';
    __PACKAGE__->declare_unsupported_methods(qw(get_namespaces));
}

sub test_unsupported : Tests {
    my $cache = CHI->new(
        driver_class => 'CHI::t::Subclass::Driver::HasUnsupported',
        global       => 1
    );
    lives_ok( sub { $cache->get_keys }, 'get_keys lives' );
    throws_ok(
        sub { $cache->get_namespaces },
        qr/method 'get_namespaces' not supported by 'CHI::t::Subclass::Driver::HasUnsupported'/,
        'get_namespaces dies'
    );
}

1;