Skip to content

Commit aaa7e07

Browse files
committed
Tests failures redone.
In one case I could make it compile by adding a preamble, in the other two cases I documente why I think tests should be skipped. Provisionally closes #1826, if you think something else, or more, should be done, just ask.
1 parent 4e6d4cd commit aaa7e07

File tree

1 file changed

+21
-3
lines changed

1 file changed

+21
-3
lines changed

doc/Language/nativecall.pod6

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -719,7 +719,23 @@ But C<addrinfo> is a structure, which means we
719719
will need to write our own Type class. However, the function declaration is
720720
straightforward:
721721
722-
=begin code :skip-test
722+
=begin code :method :preamble<use NativeCall;
723+
class SockAddr is repr('CStruct') {
724+
has int32 $.sa_family;
725+
has Str $.sa_data;
726+
};
727+
class Addrinfo is repr('CStruct') {
728+
has int32 $.ai_flags;
729+
has int32 $.ai_family;
730+
has int32 $.ai_socktype;
731+
has int32 $.ai_protocol;
732+
has int32 $.ai_addrlen;
733+
has SockAddr $.ai_addr is rw;
734+
has Str $.ai_cannonname is rw;
735+
has Addrinfo $.ai_next is rw;
736+
737+
};
738+
>
723739
sub getaddrinfo( Str $node, Str $service, Addrinfo $hints, Pointer $res is rw )
724740
returns int32
725741
is native(Str)
@@ -782,7 +798,7 @@ However, a class can have methods and C<NativeCall> does not 'touch' them for ma
782798
This means that we can add extra methods to the class to unpack the attributes in a more
783799
readable manner, e.g.,
784800
785-
=begin code :skip-test
801+
=begin code :skip-test<should be compiled as part of Addrinfo defined above>
786802
method flags {
787803
do for AddrInfo-Flags.enums { .key if $!ai_flags +| .value }
788804
}
@@ -802,7 +818,9 @@ a buffer with the C<addrinfo>.
802818
803819
Putting all these together, leads to the following program:
804820
805-
=begin code :skip-test
821+
=begin code :skip-test<Code works as is. Error with compilation maybe related to wrapping>
822+
#!/usr/bin/env perl6
823+
806824
use v6;
807825
use NativeCall;
808826

0 commit comments

Comments
 (0)