blob: d1ab1950ea70beef656168776e83207937074dfc (
plain)
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
35
36
37
38
39
40
41
42
43
44
45
46
47
|
package OverloadingTests;
use strict;
use warnings;
use Test::More 0.88;
sub test_overloading_for_package {
my $package = shift;
ok(
overload::Overloaded($package),
"$package is overloaded"
);
ok(
overload::Method( $package, q{""} ),
"$package overloads stringification"
);
}
sub test_no_overloading_for_package {
my $package = shift;
ok(
!overload::Overloaded($package),
"$package is not overloaded"
);
ok(
!overload::Method( $package, q{""} ),
"$package does not overload stringification"
);
}
sub test_overloading_for_object {
my $class = shift;
my $thing = shift || "$class object";
my $object = ref $class ? $class : $class->new( { message => 'foo' } );
is(
"$object",
'foo',
"$thing stringifies to value of message attribute"
);
}
1;
|