fix #16256: nimout: <empty> should give error (vacuously true); improve a few tests (#18089)

* fix #16256: nimout: <empty> should give error (vacuously true); improve some tests

* renamed:    tests/stdlib/t9710.nim -> tests/misc/t9710.nim

* improve tests

* fix non-DRY tests

* improve $nim_prs_D/tests/stdlib/t9091.nim

* renamed:    tests/stdlib/t9091.nim -> tests/misc/t9091.nim

* fixup

* address comment: doAssert => result.parseErrors
This commit is contained in:
Timothee Cour 2021-05-31 04:39:19 -07:00 • committed by GitHub
commit a36efb59b5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 73 additions and 106 deletions

View file

@ -1,29 +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
import std/nativesockets
import stdtest/testutils
block:
let hostname = getHostname()
doAssert hostname.len > 0
when defined(windows):
doAssert toInt(IPPROTO_IP) == 0.cint
doAssert toInt(IPPROTO_ICMP) == 1.cint
doAssert toInt(IPPROTO_TCP) == 6.cint
doAssert toInt(IPPROTO_UDP) == 17.cint
doAssert toInt(IPPROTO_IPV6) == 41.cint
doAssert toInt(IPPROTO_ICMPV6) == 58.cint
doAssert toInt(IPPROTO_RAW) == 20.cint
assertAll:
toInt(IPPROTO_IP) == 0
toInt(IPPROTO_ICMP) == 1
toInt(IPPROTO_TCP) == 6
toInt(IPPROTO_UDP) == 17
toInt(IPPROTO_IPV6) == 41
toInt(IPPROTO_ICMPV6) == 58
toInt(IPPROTO_RAW) == 20
# no changes to enum value
doAssert ord(IPPROTO_TCP) == 6
doAssert ord(IPPROTO_UDP) == 17
doAssert ord(IPPROTO_IP) == 18
doAssert ord(IPPROTO_IPV6) == 19
doAssert ord(IPPROTO_RAW) == 20
doAssert ord(IPPROTO_ICMP) == 21
doAssert ord(IPPROTO_ICMPV6) == 22
# no changes to enum value
ord(IPPROTO_TCP) == 6
ord(IPPROTO_UDP) == 17
ord(IPPROTO_IP) == 18
ord(IPPROTO_IPV6) == 19
ord(IPPROTO_RAW) == 20
ord(IPPROTO_ICMP) == 21
ord(IPPROTO_ICMPV6) == 22