File: no_replace_existing_symbols.t

package info (click to toggle)
libmoosex-emulate-class-accessor-fast-perl 0.009032-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 168 kB
  • sloc: perl: 224; makefile: 2
file content (34 lines) | stat: -rw-r--r-- 716 bytes parent folder | download | duplicates (3)
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
34
use strict;
use warnings;
use Test::More tests => 6;

{
  package SomeClass;
  use Moose;
  with 'MooseX::Emulate::Class::Accessor::Fast';

  sub anaccessor { 'wibble' }

}
{
  package SubClass;
  use base qw/SomeClass/;

  sub anotherone { 'flibble' }
  __PACKAGE__->mk_accessors(qw/ anaccessor anotherone /);
}

# 1, 2
my $someclass = SomeClass->new;
is($someclass->anaccessor, 'wibble');
$someclass->anaccessor('fnord');
is($someclass->anaccessor, 'wibble');

# 3-6
my $subclass = SubClass->new;
ok( not defined $subclass->anaccessor );
$subclass->anaccessor('fnord');
is($subclass->anaccessor, 'fnord');
is($subclass->anotherone, 'flibble');
$subclass->anotherone('fnord');
is($subclass->anotherone, 'flibble');