]> gitweb.factorcode.org Git - factor.git/blobdiff - basis/io/sockets/sockets-tests.factor
Put brackets around ipv6 addresses in `inet6 present`
[factor.git] / basis / io / sockets / sockets-tests.factor
index c586bdda43698ec534f4450ac5e703150e66f3e6..2cd28301810f33fc525de95c429701fc0be895c8 100644 (file)
@@ -37,8 +37,8 @@ os unix? [
 
 ! Test present on addrspecs
 { "4.4.4.4:12" } [ "4.4.4.4" 12 <inet4> present ] unit-test
-{ "::1:12" } [ "::1" 12 <inet6> present ] unit-test
-{ "fe80::1%1:12" } [ "fe80::1" 1 12 inet6 boa present ] unit-test
+{ "[::1]:12" } [ "::1" 12 <inet6> present ] unit-test
+{ "[fe80::1%1]:12" } [ "fe80::1" 1 12 inet6 boa present ] unit-test
 
 { B{ 1 2 3 4 } }
 [ "1.2.3.4" T{ inet4 } inet-pton ] unit-test
@@ -173,4 +173,19 @@ os unix? [
 { 80 } [ "http" protocol-port ] unit-test
 { f } [ f protocol-port ] unit-test
 
+{ "http" } [ 80 port-protocol ] unit-test
+{ f } [ f port-protocol ] unit-test
+
 [ "you-cant-resolve-me!" resolve-host ] [ addrinfo-error? ] must-fail-with
+
+[ ] [ B{ 1 2 3 } f 9000 <inet4> send-once ] unit-test
+[ ] [ B{ 1 2 3 } f 9000 <inet4> broadcast-once ] unit-test
+[ ] [ B{ 1 2 3 } "0.0.0.0" 9000 <inet4> send-once ] unit-test
+[ ] [ B{ 1 2 3 } "0.0.0.0" 9000 <inet4> broadcast-once ] unit-test
+
+ipv6-supported? [
+    [ ] [ B{ 1 2 3 } f 9000 <inet6> send-once ] unit-test
+    [ ] [ B{ 1 2 3 } f 9000 <inet6> broadcast-once ] unit-test
+    [ ] [ B{ 1 2 3 } "::" 9000 <inet6> send-once ] unit-test
+    [ ] [ B{ 1 2 3 } "::" 9000 <inet6> broadcast-once ] unit-test
+] when