authorgravatar for michael.dusan@gmail.comMichael Dusan <michael.dusan@gmail.com> 2021-05-05 05:54:47-04:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2021-05-05 05:54:47-04:00
log622a3ac876a6eac17b768625350326e9ff121f4e
tree763afb006e28f3e437dd0ff921b22c4f97a2030a
parent368e13a9a1db7feec3ce71481d075a7608f0e70d
parentc75ae8b66d57d9e7c195121e1d8d8ff5ca98e73d
signaturebadge-question-mark Signed by PGP key 4AEE18F83AFDEB23

Merge pull request #8691 from lithdew/master

x/net: fix tcp tests for openbsd and add missing `fmt` import

3 files changed, 13 insertions(+), 2 deletions(-)

lib/std/x/net/ip.zig+2
......@@ -6,6 +6,8 @@
66
77const std = @import("../../std.zig");
88
9const fmt = std.fmt;
10
911const IPv4 = std.x.os.IPv4;
1012const IPv6 = std.x.os.IPv6;
1113const Socket = std.x.os.Socket;
lib/std/x/net/tcp.zig+10-2
......@@ -282,7 +282,11 @@ test "tcp: create client/listener pair" {
282282 try listener.bind(ip.Address.initIPv4(IPv4.unspecified, 0));
283283 try listener.listen(128);
284284
285 const binded_address = try listener.getLocalAddress();
285 var binded_address = try listener.getLocalAddress();
286 switch (binded_address) {
287 .ipv4 => |*ipv4| ipv4.host = IPv4.localhost,
288 .ipv6 => |*ipv6| ipv6.host = IPv6.localhost,
289 }
286290
287291 const client = try tcp.Client.init(.ip, os.SOCK_CLOEXEC);
288292 defer client.deinit();
......@@ -302,7 +306,11 @@ test "tcp/client: set read timeout of 1 millisecond on blocking client" {
302306 try listener.bind(ip.Address.initIPv4(IPv4.unspecified, 0));
303307 try listener.listen(128);
304308
305 const binded_address = try listener.getLocalAddress();
309 var binded_address = try listener.getLocalAddress();
310 switch (binded_address) {
311 .ipv4 => |*ipv4| ipv4.host = IPv4.localhost,
312 .ipv6 => |*ipv6| ipv6.host = IPv6.localhost,
313 }
306314
307315 const client = try tcp.Client.init(.ip, os.SOCK_CLOEXEC);
308316 defer client.deinit();
lib/std/x/os/Socket.zig+1
......@@ -8,6 +8,7 @@ const std = @import("../../std.zig");
88const net = @import("net.zig");
99
1010const os = std.os;
11const fmt = std.fmt;
1112const mem = std.mem;
1213const time = std.time;
1314