summary refs log tree commit diff stats
path: root/tests/stdlib
diff options
context:
space:
mode:
authorFederico Ceratto <federico.ceratto@gmail.com>2019-02-19 22:55:35 +0000
committerDominik Picheta <dominikpicheta@googlemail.com>2019-02-23 13:06:26 +0000
commit28a83a838821cbe3efc8ddd412db966ca164ef5c (patch)
tree3b39bd39b37741754fb5b440962ece8fdbbd7780 /tests/stdlib
parentf39aa1b40bd617e5ac13f67b38548e91d49bf107 (diff)
downloadNim-28a83a838821cbe3efc8ddd412db966ca164ef5c.tar.gz
Handle IPv6 in bindAddr #7633
Add test
Diffstat (limited to 'tests/stdlib')
-rw-r--r--tests/stdlib/tnetbind.nim14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/stdlib/tnetbind.nim b/tests/stdlib/tnetbind.nim
new file mode 100644
index 000000000..b2bcf4b05
--- /dev/null
+++ b/tests/stdlib/tnetbind.nim
@@ -0,0 +1,14 @@
+import net
+
+## Test for net.bindAddr
+
+proc test() =
+  # IPv4 TCP
+  newSocket(AF_INET, SOCK_STREAM, IPPROTO_TCP).bindAddr(Port(1900), "0.0.0.0")
+  newSocket(AF_INET, SOCK_STREAM, IPPROTO_TCP).bindAddr(Port(1901))
+
+  # IPv6 TCP
+  newSocket(AF_INET6, SOCK_STREAM, IPPROTO_TCP).bindAddr(Port(1902), "::")
+  newSocket(AF_INET6, SOCK_STREAM, IPPROTO_TCP).bindAddr(Port(1903))
+
+test()