add getprotobyname (#15273)
* add getprotobyname * tests, docs, changelog * add since
This commit is contained in:
parent
7d4f0df107
commit
8c82144ba5
4 changed files with 56 additions and 0 deletions
25
tests/stdlib/tgetprotobyname.nim
Normal file
25
tests/stdlib/tgetprotobyname.nim
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
discard """
|
||||
cmd: "nim c -r --styleCheck:hint --panics:on $options $file"
|
||||
targets: "c"
|
||||
nimout: ""
|
||||
action: "run"
|
||||
exitcode: 0
|
||||
timeout: 60.0
|
||||
"""
|
||||
|
||||
import nativesockets
|
||||
|
||||
|
||||
doAssert getProtoByName("ip") == 0
|
||||
doAssert getProtoByName("ipv6") == 41
|
||||
doAssert getProtoByName("tcp") == 6
|
||||
doAssert getProtoByName("udp") == 17
|
||||
doAssert getProtoByName("icmp") == 1
|
||||
doAssert getProtoByName("ipv6-icmp") == 58
|
||||
|
||||
when defined(windows):
|
||||
doAssertRaises(OSError):
|
||||
discard getProtoByName("raw")
|
||||
|
||||
doAssertRaises(OSError):
|
||||
discard getProtoByName("Error")
|
||||
Loading…
Add table
Add a link
Reference in a new issue