This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Avoid loading .bs files twice when using XSLoader
[perl5.git] / ext / XS-APItest / t / ptr_table.t
CommitLineData
36c2b1d0
NC
1#!perl -w
2use strict;
3
4use XS::APItest;
5use Test::More;
6
7# Some addresses for testing.
8my $a = [];
9my $h = {};
10my $c = sub {};
11
12my $t1 = XS::APItest::PtrTable->new();
13isa_ok($t1, 'XS::APItest::PtrTable');
14my $t2 = XS::APItest::PtrTable->new();
15isa_ok($t2, 'XS::APItest::PtrTable');
16cmp_ok($t1, '!=', $t2, 'Not the same object');
17
18undef $t2;
19
20# Still here? :-)
21isa_ok($t1, 'XS::APItest::PtrTable');
22
23is($t1->fetch($a), 0, 'Not found');
24is($t1->fetch($h), 0, 'Not found');
25is($t1->fetch($c), 0, 'Not found');
26
27$t1->store($a, $h);
28
29cmp_ok($t1->fetch($a), '==', $h, 'Found');
30is($t1->fetch($h), 0, 'Not found');
31is($t1->fetch($c), 0, 'Not found');
32
33$t1->split();
34
35cmp_ok($t1->fetch($a), '==', $h, 'Found');
36is($t1->fetch($h), 0, 'Not found');
37is($t1->fetch($c), 0, 'Not found');
38
39$t1->clear();
40
41is($t1->fetch($a), 0, 'Not found');
42is($t1->fetch($h), 0, 'Not found');
43is($t1->fetch($c), 0, 'Not found');
44
45done_testing();