File: debuggingwarnings.t

package info (click to toggle)
libtest-mockobject-perl 1.20200122-4
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 216 kB
  • sloc: perl: 1,260; makefile: 2
file content (29 lines) | stat: -rw-r--r-- 567 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
#! perl

use strict;
use warnings;

use Test::More;
use Test::Warn;

BEGIN
{
    use_ok 'Test::MockObject';
    Test::MockObject->import( '-debug' );
}

package Foo;

sub can {}

package main;

warnings_like { UNIVERSAL::isa( {}, 'HASH' ) }
    qr/Called UNIVERSAL::isa\(\) as a function, not a method/,
    'T::MO should enable U::i when loaded with -debug flag';

warnings_exist { UNIVERSAL::can( 'Foo', 'to_string' ) }
    [ qr/Called UNIVERSAL::can\(\) as a function, not a method/ ],
    'T::MO should enable U::c when loaded with -debug flag';

done_testing();