Debian Codegraph @

t/type_longdouble__ptr.t

raw
1 use Test2::V0 -no_srand => 1;
2 use FFI::Platypus;
3 use FFI::Platypus::TypeParser;
4 use FFI::CheckLib;
5 use Config;
6
7 BEGIN {
8 skip_all 'test requires support for long double'
9 unless FFI::Platypus::TypeParser->have_type('longdouble');
10 }
11
12 my $ffi = FFI::Platypus->new;
13 $ffi->lib(find_lib lib => 'test', libpath => 't/ffi');
14
15 subtest 'Math::LongDouble is loaded when needed for return type' => sub {
16 $ffi->function( 0 => ['longdouble'] => 'int');
17 $ffi->function( 0 => ['int'] => 'int');
18
19 is($INC{'Math/LongDouble.pm'}, undef, 'not pre-loaded');
20 $ffi->function( 0 => ['longdouble*'] => 'int' );
21
22 my $pm = $INC{'Math/LongDouble.pm'};
23
24 if(eval q{ use Math::LongDouble; 1 })
25 {
26 is($pm, $INC{'Math/LongDouble.pm'});
27 isnt $pm, undef;
28 }
29 else
30 {
31 is($pm, undef);
32 is($INC{'Math/LongDouble.pm'}, undef);
33 }
34 };
35
36 done_testing;