File tree Expand file tree Collapse file tree 2 files changed +61
-1
lines changed Expand file tree Collapse file tree 2 files changed +61
-1
lines changed Original file line number Diff line number Diff line change @@ -79,7 +79,7 @@ but it is recommended that you use One (1).
79
79
80
80
sub ffi_options
81
81
{
82
- my (undef , %options ) = @_ ;
82
+ my (%options ) = @_ ;
83
83
Carp::croak(" Please call ffi_options before calling ffi" )
84
84
if defined $singleton ;
85
85
Original file line number Diff line number Diff line change
1
+ use Test2::V0 -no_srand => 1;
2
+ use Test2::Plugin::FFI::Package;
3
+ use Test2::Tools::FFI;
4
+
5
+ ffi_options api => 1;
6
+
7
+ subtest ' ffi->runtime' => sub {
8
+
9
+ my $ffi = ffi-> runtime;
10
+
11
+ is
12
+ $ffi ,
13
+ object {
14
+ call [ isa => ' FFI::Platypus' ] => T();
15
+ call api => 1;
16
+ call [ symbol_ok => ' t2t_simple_init' ] => T();
17
+ },
18
+ ;
19
+
20
+ };
21
+
22
+ subtest ' ffi->test' => sub {
23
+
24
+ my $ffi = ffi-> test;
25
+
26
+ is
27
+ $ffi ,
28
+ object {
29
+ call [ isa => ' FFI::Platypus' ] => T();
30
+ call api => 1;
31
+ call [ function => myanswer => [] => ' int' ] => object {
32
+ call call => 42;
33
+ };
34
+ call [ symbol_ok => ' myanswer' ] => T();
35
+ },
36
+ ;
37
+
38
+ };
39
+
40
+ subtest ' ffi->combined' => sub {
41
+
42
+ my $ffi = ffi-> combined;
43
+
44
+ is
45
+ $ffi ,
46
+ object {
47
+ call [ isa => ' FFI::Platypus' ] => T();
48
+ call api => 1;
49
+ call [ function => ' myanswer' => [] => ' int' ] => object {
50
+ call call => 42;
51
+ };
52
+ call [ symbol_ok => ' t2t_simple_init' ] => T();
53
+ call [ symbol_ok => ' myanswer' ] => T();
54
+ }
55
+ ;
56
+
57
+ lives { $ffi -> function(t2t_simple_init => [] => ' void' ) };
58
+ };
59
+
60
+ done_testing
You can’t perform that action at this time.
0 commit comments