File: 03class-methods.t

package info (click to toggle)
libhash-asobject-perl 0.13-4
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 124 kB
  • sloc: perl: 239; makefile: 2
file content (22 lines) | stat: -rw-r--r-- 493 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
#!/usr/bin/perl -w

use strict;
use warnings;

use Test::More 'tests' => 5;

use_ok( 'Hash::AsObject' );

eval { Hash::AsObject->foo };
like( $@, qr/Can't invoke class method/, 'forbidden class method call' );

eval { Hash::AsObject->import };
is( $@, '', 'allowed class method call' );

eval {
    my $htemp = Hash::AsObject->new;
    eval { $htemp->DESTROY('all monsters') };
    is( $@, '', '$obj->DESTROY($foo)' );
    eval { $htemp->DESTROY };
    is( $@, '', '$obj->DESTROY'       );
};