File: 08_overload.t

package info (click to toggle)
libhash-fieldhash-perl 0.15-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 296 kB
  • sloc: perl: 1,249; ansic: 207; makefile: 10
file content (27 lines) | stat: -rw-r--r-- 397 bytes parent folder | download | duplicates (7)
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
#!perl -w

use strict;
use Test::More tests => 4;

#use Hash::Util::FieldHash::Compat qw(fieldhash fieldhashes);
use Hash::FieldHash qw(:all);

{
	package T;
	use overload '""' => sub{ die 'stringify' };

	sub new{ bless {}, @_ }
}

fieldhash my %hash;

ok !exists $hash{T->new};
is_deeply \%hash, {};

{
	my $t = T->new;
	$hash{$t} = 42;
	is_deeply [values %hash], [42];
}

is_deeply \%hash, {};