diff options
author | Federico Ceratto <federico.ceratto@gmail.com> | 2019-03-16 18:51:26 +0000 |
---|---|---|
committer | Federico Ceratto <federico.ceratto@gmail.com> | 2019-03-17 16:58:27 +0000 |
commit | 5825dcb0b5d6082322ae4d6e364a8c4d6f898b93 (patch) | |
tree | 96191f9d8cc118cce33563a440c79601a26dcfa6 /tests | |
parent | 328901757a2bb5d482afafdd0e45bd54355c90b5 (diff) | |
download | Nim-5825dcb0b5d6082322ae4d6e364a8c4d6f898b93.tar.gz |
Detect local "primary" IP address
Diffstat (limited to 'tests')
-rw-r--r-- | tests/untestable/network/README.md | 8 | ||||
-rw-r--r-- | tests/untestable/network/stdlib/tnet.nim | 16 |
2 files changed, 24 insertions, 0 deletions
diff --git a/tests/untestable/network/README.md b/tests/untestable/network/README.md new file mode 100644 index 000000000..173cf105f --- /dev/null +++ b/tests/untestable/network/README.md @@ -0,0 +1,8 @@ +This directory contains tests that require networking and cannot be run in CI. + +The tests can be run manually during development using: +```nim +./koch tests cat untestable/network/stdlib +``` + +The directory structure mimics tests/ diff --git a/tests/untestable/network/stdlib/tnet.nim b/tests/untestable/network/stdlib/tnet.nim new file mode 100644 index 000000000..cb0f38944 --- /dev/null +++ b/tests/untestable/network/stdlib/tnet.nim @@ -0,0 +1,16 @@ +discard """ +outputsub: "" +""" + +import net, nativesockets +import unittest + +suite "getPrimaryIPAddr": + test "localhost v4": + check getPrimaryIPAddr(parseIpAddress("127.0.0.1")) == parseIpAddress("127.0.0.1") + + test "localhost v6": + check getPrimaryIPAddr(parseIpAddress("::1")) == parseIpAddress("::1") + + test "v4": + check getPrimaryIPAddr() != parseIpAddress("127.0.0.1") |