File: autobox_subclass.t

package info (click to toggle)
liblist-objects-withutils-perl 2.028003-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 1,292 kB
  • sloc: perl: 1,957; makefile: 17; sh: 6
file content (27 lines) | stat: -rw-r--r-- 605 bytes parent folder | download | duplicates (4)
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
use Test::More;
use strict; use warnings FATAL => 'all';

{ package My::Array::Obj;
  use strict; use warnings FATAL => 'all';
  use parent 'List::Objects::WithUtils::Array';
  sub foo { 1 }
}
{ package My::Hash::Obj;
  use strict; use warnings FATAL => 'all';
  use parent 'List::Objects::WithUtils::Hash';
  sub bar { 1 }
}

{ package My::Autoboxen;
  use strict; use warnings FATAL => 'all';
  use List::Objects::WithUtils::Autobox
    HASH  => 'My::Hash::Obj',
    ARRAY => 'My::Array::Obj' ;

  use Test::More;

  ok []->foo, 'autoboxed array ok';
  ok {}->bar, 'autoboxed hash ok';
}

done_testing;