File: SUPER-can.t

package info (click to toggle)
libuniversal-can-perl 1.20140328-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 152 kB
  • sloc: perl: 326; makefile: 2
file content (34 lines) | stat: -rw-r--r-- 545 bytes parent folder | download | duplicates (5)
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
use UNIVERSAL::can;

use strict;
use warnings;


package MyClass;

my @caller;

sub can {
    push @caller, caller;
}

sub test {
    my ($invocant, $method) = @_;
    $invocant->SUPER::can($method);
}


package main;

use Test::More tests => 2;

my @warning;
local $SIG{__WARN__} = sub { push @warning, @_ };

MyClass->test("foo");

is_deeply(\@warning, [],
    "CLASS->SUPER::can(METHOD) does not give a warning");

is_deeply(\@caller, [],
    "CLASS->SUPER::can(METHOD) does not invoke CLASS->can(METHOD)");