aboutsummaryrefslogtreecommitdiff
path: root/lib/std/json/stringify_test.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2023-10-22 12:16:35 -0700
committerAndrew Kelley <andrew@ziglang.org>2023-10-22 12:16:35 -0700
commit6f0198cadbe29294f2bf3153a27beebd64377566 (patch)
tree99e6a8657282d9ffe09944a52c78b7e5b6949071 /lib/std/json/stringify_test.zig
parent9f0359d78f9facc38418e32b0e8c1bf6f99f0d26 (diff)
downloadzig-6f0198cadbe29294f2bf3153a27beebd64377566.tar.gz
zig-6f0198cadbe29294f2bf3153a27beebd64377566.zip
Revert "Merge pull request #17637 from jacobly0/x86_64-test-std"
This reverts commit 0c99ba1eab63865592bb084feb271cd4e4b0357e, reversing changes made to 5f92b070bf284f1493b1b5d433dd3adde2f46727. This caused a CI failure when it landed in master branch due to a 128-bit `@byteSwap` in std.mem.
Diffstat (limited to 'lib/std/json/stringify_test.zig')
-rw-r--r--lib/std/json/stringify_test.zig41
1 files changed, 0 insertions, 41 deletions
diff --git a/lib/std/json/stringify_test.zig b/lib/std/json/stringify_test.zig
index d2c4104316..9baeae9389 100644
--- a/lib/std/json/stringify_test.zig
+++ b/lib/std/json/stringify_test.zig
@@ -1,5 +1,4 @@
const std = @import("std");
-const builtin = @import("builtin");
const mem = std.mem;
const testing = std.testing;
@@ -16,8 +15,6 @@ const writeStreamMaxDepth = @import("stringify.zig").writeStreamMaxDepth;
const writeStreamArbitraryDepth = @import("stringify.zig").writeStreamArbitraryDepth;
test "json write stream" {
- if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
-
var out_buf: [1024]u8 = undefined;
var slice_stream = std.io.fixedBufferStream(&out_buf);
const out = slice_stream.writer();
@@ -100,8 +97,6 @@ fn getJsonObject(allocator: std.mem.Allocator) !Value {
}
test "stringify null optional fields" {
- if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
-
const MyStruct = struct {
optional: ?[]const u8 = null,
required: []const u8 = "something",
@@ -123,8 +118,6 @@ test "stringify null optional fields" {
}
test "stringify basic types" {
- if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
-
try testStringify("false", false, .{});
try testStringify("true", true, .{});
try testStringify("null", @as(?u8, null), .{});
@@ -141,8 +134,6 @@ test "stringify basic types" {
}
test "stringify string" {
- if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
-
try testStringify("\"hello\"", "hello", .{});
try testStringify("\"with\\nescapes\\r\"", "with\nescapes\r", .{});
try testStringify("\"with\\nescapes\\r\"", "with\nescapes\r", .{ .escape_unicode = true });
@@ -167,16 +158,12 @@ test "stringify string" {
}
test "stringify many-item sentinel-terminated string" {
- if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
-
try testStringify("\"hello\"", @as([*:0]const u8, "hello"), .{});
try testStringify("\"with\\nescapes\\r\"", @as([*:0]const u8, "with\nescapes\r"), .{ .escape_unicode = true });
try testStringify("\"with unicode\\u0001\"", @as([*:0]const u8, "with unicode\u{1}"), .{ .escape_unicode = true });
}
test "stringify enums" {
- if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
-
const E = enum {
foo,
bar,
@@ -186,15 +173,11 @@ test "stringify enums" {
}
test "stringify enum literals" {
- if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
-
try testStringify("\"foo\"", .foo, .{});
try testStringify("\"bar\"", .bar, .{});
}
test "stringify tagged unions" {
- if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
-
const T = union(enum) {
nothing,
foo: u32,
@@ -206,16 +189,12 @@ test "stringify tagged unions" {
}
test "stringify struct" {
- if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
-
try testStringify("{\"foo\":42}", struct {
foo: u32,
}{ .foo = 42 }, .{});
}
test "emit_strings_as_arrays" {
- if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
-
// Should only affect string values, not object keys.
try testStringify("{\"foo\":\"bar\"}", .{ .foo = "bar" }, .{});
try testStringify("{\"foo\":[98,97,114]}", .{ .foo = "bar" }, .{ .emit_strings_as_arrays = true });
@@ -230,8 +209,6 @@ test "emit_strings_as_arrays" {
}
test "stringify struct with indentation" {
- if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
-
try testStringify(
\\{
\\ "foo": 42,
@@ -277,8 +254,6 @@ test "stringify struct with indentation" {
}
test "stringify struct with void field" {
- if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
-
try testStringify("{\"foo\":42}", struct {
foo: u32,
bar: void = {},
@@ -286,8 +261,6 @@ test "stringify struct with void field" {
}
test "stringify array of structs" {
- if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
-
const MyStruct = struct {
foo: u32,
};
@@ -299,8 +272,6 @@ test "stringify array of structs" {
}
test "stringify struct with custom stringifier" {
- if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
-
try testStringify("[\"something special\",42]", struct {
foo: u32,
const Self = @This();
@@ -315,16 +286,12 @@ test "stringify struct with custom stringifier" {
}
test "stringify vector" {
- if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
-
try testStringify("[1,1]", @as(@Vector(2, u32), @splat(1)), .{});
try testStringify("\"AA\"", @as(@Vector(2, u8), @splat('A')), .{});
try testStringify("[65,65]", @as(@Vector(2, u8), @splat('A')), .{ .emit_strings_as_arrays = true });
}
test "stringify tuple" {
- if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
-
try testStringify("[\"foo\",42]", std.meta.Tuple(&.{ []const u8, usize }){ "foo", 42 }, .{});
}
@@ -411,8 +378,6 @@ fn testStringifyArbitraryDepth(expected: []const u8, value: anytype, options: St
}
test "stringify alloc" {
- if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
-
const allocator = std.testing.allocator;
const expected =
\\{"foo":"bar","answer":42,"my_friend":"sammy"}
@@ -424,8 +389,6 @@ test "stringify alloc" {
}
test "comptime stringify" {
- if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
-
comptime testStringifyMaxDepth("false", false, .{}, null) catch unreachable;
comptime testStringifyMaxDepth("false", false, .{}, 0) catch unreachable;
comptime testStringifyArbitraryDepth("false", false, .{}) catch unreachable;
@@ -446,8 +409,6 @@ test "comptime stringify" {
}
test "print" {
- if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
-
var out_buf: [1024]u8 = undefined;
var slice_stream = std.io.fixedBufferStream(&out_buf);
const out = slice_stream.writer();
@@ -479,8 +440,6 @@ test "print" {
}
test "nonportable numbers" {
- if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
-
try testStringify("9999999999999999", 9999999999999999, .{});
try testStringify("\"9999999999999999\"", 9999999999999999, .{ .emit_nonportable_numbers_as_strings = true });
}