Forgot to MANIFEST the new Net::hostent test.
[p5sagit/p5-mst-13.2.git] / t / lib / class-struct.t
CommitLineData
ad6edfcb 1#!./perl -w
2
3BEGIN {
4 chdir 't' if -d 't';
5 @INC = '../lib';
6}
7
8print "1..2\n";
9
10package aClass;
11
12sub new { bless {}, shift }
13
14sub meth { 42 }
15
16package MyObj;
17
18use Class::Struct 'struct';
19
20use Class::Struct SomeClass => { SomeElem => '$' };
21
22struct( s => '$', a => '@', h => '%', c => 'aClass' );
23
24my $obj = MyObj->new;
25
26$obj->s('foo');
27
28print "not " unless $obj->s() eq 'foo';
29print "ok 1\n";
30
31my $arf = $obj->a;
32
33print "not " unless ref $arf eq 'ARRAY';
34print "ok 2\n";
35
36$obj->a(2, 'secundus');
37
38print "not " unless $obj->a(2) eq 'secundus';
39print "ok 3\n";
40
41my $hrf = $obj->h;
42
43print "not " unless ref $hrf eq 'HASH';
44print "ok 4\n";
45
46$obj->h('x', 10);
47
48print "not " unless $obj->h('x') == 10;
49print "ok 5\n";
50
51my $orf = $obj->c;
52
53print "not " unless ref $orf eq 'aClass';
54print "ok 6\n";
55
56print "not " unless $obj->c->meth() == 42;
57print "ok 7\n";
58
59my $obk = SomeClass->new();
60
61$obk->SomeElem(123);
62
63print "not " unless $obk->SomeElem() == 123;
64print "ok 8\n";
65
66
67
68
69