diff options
author | Dominik Picheta <dominikpicheta@googlemail.com> | 2015-03-10 11:08:21 +0000 |
---|---|---|
committer | Dominik Picheta <dominikpicheta@googlemail.com> | 2015-03-10 11:08:21 +0000 |
commit | 3ea3aa633d92e9a9c3f4668727c194cfae3ce7c4 (patch) | |
tree | 0ec04a10efa9f11888030a2d7009e51282a279c4 /tests | |
parent | 796a588b1cd6bbfa5d49b521c9c8d52ff8a3e4fb (diff) | |
parent | 7cffd290bf5d20c7b9f191f222ae3f4ea7952523 (diff) | |
download | Nim-3ea3aa633d92e9a9c3f4668727c194cfae3ce7c4.tar.gz |
Merge pull request #2279 from nathan-hoad/sni-support-for-openssl
Add SNI support to client and server sockets.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/stdlib/tnet.nim | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/tests/stdlib/tnet.nim b/tests/stdlib/tnet.nim new file mode 100644 index 000000000..e8ada05e7 --- /dev/null +++ b/tests/stdlib/tnet.nim @@ -0,0 +1,47 @@ +import net +import unittest + +suite "isIpAddress tests": + test "127.0.0.1 is valid": + check isIpAddress("127.0.0.1") == true + + test "ipv6 localhost is valid": + check isIpAddress("::1") == true + + test "fqdn is not an ip address": + check isIpAddress("example.com") == false + + test "random string is not an ipaddress": + check isIpAddress("foo bar") == false + + test "5127.0.0.1 is invalid": + check isIpAddress("5127.0.0.1") == false + + test "ipv6 is valid": + check isIpAddress("2001:cdba:0000:0000:0000:0000:3257:9652") == true + + test "invalid ipv6": + check isIpAddress("gggg:cdba:0000:0000:0000:0000:3257:9652") == false + + +suite "parseIpAddress tests": + test "127.0.0.1 is valid": + discard parseIpAddress("127.0.0.1") + + test "ipv6 localhost is valid": + discard parseIpAddress("::1") + + test "fqdn is not an ip address": + expect(ValueError): + discard parseIpAddress("example.com") + + test "random string is not an ipaddress": + expect(ValueError): + discard parseIpAddress("foo bar") + + test "ipv6 is valid": + discard parseIpAddress("2001:cdba:0000:0000:0000:0000:3257:9652") + + test "invalid ipv6": + expect(ValueError): + discard parseIpAddress("gggg:cdba:0000:0000:0000:0000:3257:9652") |