File: 30unit-class.t

package info (click to toggle)
libobject-pad-perl 0.821-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 936 kB
  • sloc: ansic: 3,361; perl: 3,328; pascal: 28; makefile: 3
file content (23 lines) | stat: -rw-r--r-- 303 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/usr/bin/perl

use v5.18;
use warnings;

use Test2::V0;

use Object::Pad 0.800;

class Counter;
field $count = 0;
method count :lvalue { $count }
method inc { $count++ }

package main;

{
   my $counter = Counter->new;
   $counter->inc;
   is( $counter->count, 1, 'Count is now 1' );
}

done_testing;