This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Fix XS types in typemap in order to deal with references with get magics correctly
[perl5.git] / ext / XS-APItest / t / refs.t
CommitLineData
88b5a879 1#!perl
2
3use strict;
4use warnings;
5
6use Test::More tests => 8;
7
8use Tie::Scalar;
9
10use_ok('XS::APItest');
11
12my $a;
13my $sr = \$a;
14my $ar = [];
15my $hr = {};
16my $cr = sub{};
17
18is XS::APItest::take_svref($sr), $sr;
19is XS::APItest::take_avref($ar), $ar;
20is XS::APItest::take_hvref($hr), $hr;
21is XS::APItest::take_cvref($cr), $cr;
22
23my $obj = tie my $ref, 'Tie::StdScalar';
24${$obj} = $sr;
25is XS::APItest::take_svref($sr), $sr;
26
27${$obj} = $ar;
28is XS::APItest::take_avref($ar), $ar;
29
30${$obj} = $hr;
31is XS::APItest::take_hvref($hr), $hr;
32
33${$obj} = $cr;
34is XS::APItest::take_cvref($cr), $cr;