File: import.t

package info (click to toggle)
libb-hooks-op-check-entersubforcv-perl 0.10-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 176 kB
  • sloc: perl: 1,339; ansic: 10; makefile: 3
file content (33 lines) | stat: -rw-r--r-- 505 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
33
use strict;
use warnings;
use Test::More tests => 9;

sub foo { 42 }

my $i;
BEGIN { $i = 0; }

sub callback {
    my ($cv, $op) = @_;

    is($cv->(), 42, 'we god the right coderef');
    isa_ok($op, 'B::OP');
    is($op->name, 'entersub', 'op looks sane');

    $i++;
}

use B::Hooks::OP::Check::EntersubForCV
    \&foo => \&callback,
    \&foo => \&callback,
    \&callback => sub {};

BEGIN { is($i, 0) }

foo();

BEGIN { is($i, 2) }

no B::Hooks::OP::Check::EntersubForCV \&foo;

BEGIN { is($i, 2) }