File: 13_pointcut_true.t

package info (click to toggle)
libaspect-perl 1.04-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 720 kB
  • sloc: perl: 6,846; makefile: 2
file content (27 lines) | stat: -rw-r--r-- 386 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
#!/usr/bin/perl

use strict;
BEGIN {
	$|  = 1;
	$^W = 1;
}

use Test::More tests => 4;
use Test::NoWarnings;
use Aspect;

my $COUNT = 0;

sub foo {
	$COUNT += 1
}

# Set up a simple permanent advice
before {
	$COUNT += 10
} call 'main::foo'
& true { $COUNT == 1 };

is( foo(),  1, 'Advice did not fire' );
is( foo(), 12, 'Advice did fired'    );
is( foo(), 13, 'Advice did not fire' );