io.sockets: adding docs and tests for port-protocol.

char-rename
John Benediktsson 2016-08-01 10:22:16 -07:00
parent 97d3c42091
commit b864d49e8c
2 changed files with 9 additions and 0 deletions

View File

@ -292,3 +292,9 @@ HELP: with-local-address
HELP: protocol-port HELP: protocol-port
{ $values { "protocol" "a protocol string" } { "port" { $maybe integer } } } { $values { "protocol" "a protocol string" } { "port" { $maybe integer } } }
{ $description "Outputs the port number associated with a protocol, or " { $link f } " if the protocol is unknown." } ; { $description "Outputs the port number associated with a protocol, or " { $link f } " if the protocol is unknown." } ;
HELP: port-protocol
{ $values { "port" integer } { "protocol" { $maybe "a protocol string" } } }
{ $description "Outputs the protocol associated with a port number, or " { $link f } " if the port number is unknown." } ;
{ protocol-port port-protocol } related-words

View File

@ -173,6 +173,9 @@ os unix? [
{ 80 } [ "http" protocol-port ] unit-test { 80 } [ "http" protocol-port ] unit-test
{ f } [ f protocol-port ] unit-test { f } [ f protocol-port ] unit-test
{ "http" } [ 80 port-protocol ] unit-test
{ f } [ f port-protocol ] unit-test
[ "you-cant-resolve-me!" resolve-host ] [ addrinfo-error? ] must-fail-with [ "you-cant-resolve-me!" resolve-host ] [ addrinfo-error? ] must-fail-with
[ ] [ B{ 1 2 3 } f 9000 <inet4> send-once ] unit-test [ ] [ B{ 1 2 3 } f 9000 <inet4> send-once ] unit-test