File: always_warn.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 (32 lines) | stat: -rw-r--r-- 521 bytes parent folder | download | duplicates (6)
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
#!perl

use strict;
use warnings;

use lib 't/lib';

use Test::More tests => 2;
use Test::SmallWarn;

# must happen here to register warnings category
BEGIN { use_ok( 'UNIVERSAL::can', '-always_warn' ) };

{
	package Demo;

	sub new { bless {}, shift }

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

my $demo = Demo->new( 'Demo' );
{
	no warnings;
	warning_like { UNIVERSAL::can( $demo, 'new' ) }
		qr/Called UNIVERSAL::can/,
		'-always_warn flag should make module always warn';
}