Merge pull request #8691 from lithdew/master

x/net: fix tcp tests for openbsd and add missing `fmt` import
This commit is contained in:
Michael Dusan 2021-05-05 05:54:47 -04:00 committed by GitHub
commit 622a3ac876
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 2 deletions

View File

@ -6,6 +6,8 @@
const std = @import("../../std.zig");
const fmt = std.fmt;
const IPv4 = std.x.os.IPv4;
const IPv6 = std.x.os.IPv6;
const Socket = std.x.os.Socket;

View File

@ -282,7 +282,11 @@ test "tcp: create client/listener pair" {
try listener.bind(ip.Address.initIPv4(IPv4.unspecified, 0));
try listener.listen(128);
const binded_address = try listener.getLocalAddress();
var binded_address = try listener.getLocalAddress();
switch (binded_address) {
.ipv4 => |*ipv4| ipv4.host = IPv4.localhost,
.ipv6 => |*ipv6| ipv6.host = IPv6.localhost,
}
const client = try tcp.Client.init(.ip, os.SOCK_CLOEXEC);
defer client.deinit();
@ -302,7 +306,11 @@ test "tcp/client: set read timeout of 1 millisecond on blocking client" {
try listener.bind(ip.Address.initIPv4(IPv4.unspecified, 0));
try listener.listen(128);
const binded_address = try listener.getLocalAddress();
var binded_address = try listener.getLocalAddress();
switch (binded_address) {
.ipv4 => |*ipv4| ipv4.host = IPv4.localhost,
.ipv6 => |*ipv6| ipv6.host = IPv6.localhost,
}
const client = try tcp.Client.init(.ip, os.SOCK_CLOEXEC);
defer client.deinit();

View File

@ -8,6 +8,7 @@ const std = @import("../../std.zig");
const net = @import("net.zig");
const os = std.os;
const fmt = std.fmt;
const mem = std.mem;
const time = std.time;