aboutsummaryrefslogtreecommitdiff
path: root/lib/std/net
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2021-10-04 23:47:27 -0700
committerAndrew Kelley <andrew@ziglang.org>2021-10-04 23:48:55 -0700
commit6115cf22404467fd13d0290fc022d51d372d139a (patch)
tree26c0bab951c81e89b5f0edcc5dc9f4b8e64df7db /lib/std/net
parent78902db68bbd400f6d84b65280c31d417105f2a8 (diff)
downloadzig-6115cf22404467fd13d0290fc022d51d372d139a.tar.gz
zig-6115cf22404467fd13d0290fc022d51d372d139a.zip
migrate from `std.Target.current` to `@import("builtin").target`
closes #9388 closes #9321
Diffstat (limited to 'lib/std/net')
-rw-r--r--lib/std/net/test.zig24
1 files changed, 12 insertions, 12 deletions
diff --git a/lib/std/net/test.zig b/lib/std/net/test.zig
index 16a43fa421..1742fb2947 100644
--- a/lib/std/net/test.zig
+++ b/lib/std/net/test.zig
@@ -1,5 +1,5 @@
const std = @import("../std.zig");
-const builtin = std.builtin;
+const builtin = @import("builtin");
const net = std.net;
const mem = std.mem;
const testing = std.testing;
@@ -35,7 +35,7 @@ test "parse and render IPv6 addresses" {
var newIp = std.fmt.bufPrint(buffer[0..], "{}", .{addr}) catch unreachable;
try std.testing.expect(std.mem.eql(u8, printed[i], newIp[1 .. newIp.len - 3]));
- if (std.builtin.os.tag == .linux) {
+ if (builtin.os.tag == .linux) {
var addr_via_resolve = net.Address.resolveIp6(ip, 0) catch unreachable;
var newResolvedIp = std.fmt.bufPrint(buffer[0..], "{}", .{addr_via_resolve}) catch unreachable;
try std.testing.expect(std.mem.eql(u8, printed[i], newResolvedIp[1 .. newResolvedIp.len - 3]));
@@ -49,7 +49,7 @@ test "parse and render IPv6 addresses" {
try testing.expectError(error.Incomplete, net.Address.parseIp6("FF01:", 0));
try testing.expectError(error.InvalidIpv4Mapping, net.Address.parseIp6("::123.123.123.123", 0));
// TODO Make this test pass on other operating systems.
- if (std.builtin.os.tag == .linux) {
+ if (builtin.os.tag == .linux) {
try testing.expectError(error.Incomplete, net.Address.resolveIp6("ff01::fb%", 0));
try testing.expectError(error.Overflow, net.Address.resolveIp6("ff01::fb%wlp3s0s0s0s0s0s0s0s0", 0));
try testing.expectError(error.Overflow, net.Address.resolveIp6("ff01::fb%12345678901234", 0));
@@ -57,7 +57,7 @@ test "parse and render IPv6 addresses" {
}
test "invalid but parseable IPv6 scope ids" {
- if (std.builtin.os.tag != .linux) {
+ if (builtin.os.tag != .linux) {
// Currently, resolveIp6 with alphanumerical scope IDs only works on Linux.
// TODO Make this test pass on other operating systems.
return error.SkipZigTest;
@@ -106,11 +106,11 @@ test "parse and render UNIX addresses" {
test "resolve DNS" {
if (builtin.os.tag == .wasi) return error.SkipZigTest;
- if (std.builtin.os.tag == .windows) {
+ if (builtin.os.tag == .windows) {
_ = try std.os.windows.WSAStartup(2, 2);
}
defer {
- if (std.builtin.os.tag == .windows) {
+ if (builtin.os.tag == .windows) {
std.os.windows.WSACleanup() catch unreachable;
}
}
@@ -143,11 +143,11 @@ test "listen on a port, send bytes, receive bytes" {
if (builtin.single_threaded) return error.SkipZigTest;
if (builtin.os.tag == .wasi) return error.SkipZigTest;
- if (std.builtin.os.tag == .windows) {
+ if (builtin.os.tag == .windows) {
_ = try std.os.windows.WSAStartup(2, 2);
}
defer {
- if (std.builtin.os.tag == .windows) {
+ if (builtin.os.tag == .windows) {
std.os.windows.WSACleanup() catch unreachable;
}
}
@@ -185,7 +185,7 @@ test "listen on a port, send bytes, receive bytes" {
test "listen on a port, send bytes, receive bytes" {
if (!std.io.is_async) return error.SkipZigTest;
- if (std.builtin.os.tag != .linux and !std.builtin.os.tag.isDarwin()) {
+ if (builtin.os.tag != .linux and !builtin.os.tag.isDarwin()) {
// TODO build abstractions for other operating systems
return error.SkipZigTest;
}
@@ -207,7 +207,7 @@ test "listen on a port, send bytes, receive bytes" {
test "listen on ipv4 try connect on ipv6 then ipv4" {
if (!std.io.is_async) return error.SkipZigTest;
- if (std.builtin.os.tag != .linux and !std.builtin.os.tag.isDarwin()) {
+ if (builtin.os.tag != .linux and !builtin.os.tag.isDarwin()) {
// TODO build abstractions for other operating systems
return error.SkipZigTest;
}
@@ -267,11 +267,11 @@ test "listen on a unix socket, send bytes, receive bytes" {
if (builtin.single_threaded) return error.SkipZigTest;
if (!net.has_unix_sockets) return error.SkipZigTest;
- if (std.builtin.os.tag == .windows) {
+ if (builtin.os.tag == .windows) {
_ = try std.os.windows.WSAStartup(2, 2);
}
defer {
- if (std.builtin.os.tag == .windows) {
+ if (builtin.os.tag == .windows) {
std.os.windows.WSACleanup() catch unreachable;
}
}