File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2323 - name : build examples on WASI
2424 run : |
2525 export PATH="$HOME/.cargo/bin:$PATH"
26- cargo build --examples
26+ cargo build --examples
27+ - name : install WasmEdge
28+ run : |
29+ curl -sSf https://raw.githubusercontent.com/WasmEdge/WasmEdge/master/utils/install.sh | bash
30+ - name : run unit tests
31+ run : |
32+ source /home/runner/.wasmedge/env
33+ cargo test
Original file line number Diff line number Diff line change @@ -630,3 +630,34 @@ impl UdpSocket {
630630 Ok ( sent)
631631 }
632632}
633+
634+ #[ cfg( test) ]
635+ mod tests {
636+ use super :: * ;
637+
638+ #[ test]
639+ fn test_dns_query ( ) {
640+ let node = String :: from ( "www.rust-lang" ) ;
641+ let service = String :: from ( "http" ) ;
642+ let hints: WasiAddrinfo = WasiAddrinfo :: default ( ) ;
643+ let mut sockaddr = Vec :: new ( ) ;
644+ let mut sockbuff = Vec :: new ( ) ;
645+ let mut ai_canonname = Vec :: new ( ) ;
646+ let addrinfo = WasiAddrinfo :: get_addrinfo (
647+ & node,
648+ & service,
649+ & hints,
650+ 10 ,
651+ & mut sockaddr,
652+ & mut sockbuff,
653+ & mut ai_canonname,
654+ )
655+ . unwrap ( ) ;
656+ assert ! ( addrinfo. len( ) > 0 ) ;
657+ }
658+
659+ #[ test]
660+ fn test_tcp_listen ( ) {
661+ let _ = TcpListener :: bind ( "127.0.0.1:52222" , true ) . unwrap ( ) ;
662+ }
663+ }
You can’t perform that action at this time.
0 commit comments