aboutsummaryrefslogtreecommitdiff
path: root/test/behavior
diff options
context:
space:
mode:
authorMatthew Lugg <mlugg@mlugg.co.uk>2025-02-03 16:38:35 +0000
committerGitHub <noreply@github.com>2025-02-03 16:38:35 +0000
commit317722b37b201e393aed60045f4bf9649103e63e (patch)
treed0485fccbcfd0d2951ac373bbd5d483cc8539ca2 /test/behavior
parente61acd8eb563d3c233202ef3a1a63df384d09943 (diff)
parentdc5c8278474f998360bc48e3dd0fe9a2929b4374 (diff)
downloadzig-317722b37b201e393aed60045f4bf9649103e63e.tar.gz
zig-317722b37b201e393aed60045f4bf9649103e63e.zip
Merge pull request #20271 from MasonRemaley/zon
ZON
Diffstat (limited to 'test/behavior')
-rw-r--r--test/behavior/zon.zig519
-rw-r--r--test/behavior/zon/a.zon1
-rw-r--r--test/behavior/zon/abc-escaped.zon1
-rw-r--r--test/behavior/zon/abc.zon1
-rw-r--r--test/behavior/zon/array.zon1
-rw-r--r--test/behavior/zon/complex.zon7
-rw-r--r--test/behavior/zon/enum_field.zon1
-rw-r--r--test/behavior/zon/escaped_enum.zon1
-rw-r--r--test/behavior/zon/escaped_struct.zon2
-rw-r--r--test/behavior/zon/false.zon4
-rw-r--r--test/behavior/zon/floats.zon25
-rw-r--r--test/behavior/zon/foo.zon1
-rw-r--r--test/behavior/zon/inf_and_nan.zon5
-rw-r--r--test/behavior/zon/ints.zon40
-rw-r--r--test/behavior/zon/multiline_string.zon4
-rw-r--r--test/behavior/zon/none.zon1
-rw-r--r--test/behavior/zon/recursive.zon1
-rw-r--r--test/behavior/zon/slice-abc.zon1
-rw-r--r--test/behavior/zon/slice-empty.zon1
-rw-r--r--test/behavior/zon/slice1_no_newline.zon1
-rw-r--r--test/behavior/zon/some.zon1
-rw-r--r--test/behavior/zon/string_embedded_null.zon1
-rw-r--r--test/behavior/zon/true.zon1
-rw-r--r--test/behavior/zon/tuple.zon1
-rw-r--r--test/behavior/zon/union1.zon1
-rw-r--r--test/behavior/zon/union2.zon1
-rw-r--r--test/behavior/zon/union3.zon1
-rw-r--r--test/behavior/zon/vec0.zon1
-rw-r--r--test/behavior/zon/vec1.zon1
-rw-r--r--test/behavior/zon/vec2.zon1
-rw-r--r--test/behavior/zon/vec3_bool.zon1
-rw-r--r--test/behavior/zon/vec3_float.zon1
-rw-r--r--test/behavior/zon/vec3_int.zon1
-rw-r--r--test/behavior/zon/vec3_int_opt.zon1
-rw-r--r--test/behavior/zon/z.zon1
35 files changed, 633 insertions, 0 deletions
diff --git a/test/behavior/zon.zig b/test/behavior/zon.zig
new file mode 100644
index 0000000000..2003a87600
--- /dev/null
+++ b/test/behavior/zon.zig
@@ -0,0 +1,519 @@
+const std = @import("std");
+
+const expect = std.testing.expect;
+const expectEqual = std.testing.expectEqual;
+const expectEqualDeep = std.testing.expectEqualDeep;
+const expectEqualSlices = std.testing.expectEqualSlices;
+const expectEqualStrings = std.testing.expectEqualStrings;
+
+test "bool" {
+ try expectEqual(true, @as(bool, @import("zon/true.zon")));
+ try expectEqual(false, @as(bool, @import("zon/false.zon")));
+}
+
+test "optional" {
+ const some: ?u32 = @import("zon/some.zon");
+ const none: ?u32 = @import("zon/none.zon");
+ const @"null": @TypeOf(null) = @import("zon/none.zon");
+ try expectEqual(@as(u32, 10), some);
+ try expectEqual(@as(?u32, null), none);
+ try expectEqual(null, @"null");
+}
+
+test "union" {
+ // No tag
+ {
+ const Union = union {
+ x: f32,
+ y: bool,
+ z: void,
+ };
+
+ const union1: Union = @import("zon/union1.zon");
+ const union2: Union = @import("zon/union2.zon");
+ const union3: Union = @import("zon/union3.zon");
+
+ try expectEqual(1.5, union1.x);
+ try expectEqual(true, union2.y);
+ try expectEqual({}, union3.z);
+ }
+
+ // Inferred tag
+ {
+ const Union = union(enum) {
+ x: f32,
+ y: bool,
+ z: void,
+ };
+
+ const union1: Union = comptime @import("zon/union1.zon");
+ const union2: Union = @import("zon/union2.zon");
+ const union3: Union = @import("zon/union3.zon");
+
+ try expectEqual(1.5, union1.x);
+ try expectEqual(true, union2.y);
+ try expectEqual({}, union3.z);
+ }
+
+ // Explicit tag
+ {
+ const Tag = enum(i128) {
+ x = -1,
+ y = 2,
+ z = 1,
+ };
+ const Union = union(Tag) {
+ x: f32,
+ y: bool,
+ z: void,
+ };
+
+ const union1: Union = @import("zon/union1.zon");
+ const union2: Union = @import("zon/union2.zon");
+ const union3: Union = @import("zon/union3.zon");
+
+ try expectEqual(1.5, union1.x);
+ try expectEqual(true, union2.y);
+ try expectEqual({}, union3.z);
+ }
+}
+
+test "struct" {
+ const Vec0 = struct {};
+ const Vec1 = struct { x: f32 };
+ const Vec2 = struct { x: f32, y: f32 };
+ const Escaped = struct { @"0": f32, foo: f32 };
+ try expectEqual(Vec0{}, @as(Vec0, @import("zon/vec0.zon")));
+ try expectEqual(Vec1{ .x = 1.5 }, @as(Vec1, @import("zon/vec1.zon")));
+ try expectEqual(Vec2{ .x = 1.5, .y = 2 }, @as(Vec2, @import("zon/vec2.zon")));
+ try expectEqual(Escaped{ .@"0" = 1.5, .foo = 2 }, @as(Escaped, @import("zon/escaped_struct.zon")));
+}
+
+test "struct default fields" {
+ const Vec3 = struct {
+ x: f32,
+ y: f32,
+ z: f32 = 123.4,
+ };
+ try expectEqual(Vec3{ .x = 1.5, .y = 2.0, .z = 123.4 }, @as(Vec3, @import("zon/vec2.zon")));
+ const ascribed: Vec3 = @import("zon/vec2.zon");
+ try expectEqual(Vec3{ .x = 1.5, .y = 2.0, .z = 123.4 }, ascribed);
+
+ const Vec2 = struct {
+ x: f32 = 20.0,
+ y: f32 = 10.0,
+ };
+ try expectEqual(Vec2{ .x = 1.5, .y = 2.0 }, @as(Vec2, @import("zon/vec2.zon")));
+}
+
+test "struct enum field" {
+ const Struct = struct {
+ x: enum { x, y, z },
+ };
+ try expectEqual(Struct{ .x = .z }, @as(Struct, @import("zon/enum_field.zon")));
+}
+
+test "tuple" {
+ const Tuple = struct { f32, bool, []const u8, u16 };
+ try expectEqualDeep(Tuple{ 1.2, true, "hello", 3 }, @as(Tuple, @import("zon/tuple.zon")));
+}
+
+test "comptime fields" {
+ // Test setting comptime tuple fields to the correct value
+ {
+ const Tuple = struct {
+ comptime f32 = 1.2,
+ comptime bool = true,
+ comptime []const u8 = "hello",
+ comptime u16 = 3,
+ };
+ try expectEqualDeep(Tuple{ 1.2, true, "hello", 3 }, @as(Tuple, @import("zon/tuple.zon")));
+ }
+
+ // Test setting comptime struct fields to the correct value
+ {
+ const Vec2 = struct {
+ comptime x: f32 = 1.5,
+ comptime y: f32 = 2.0,
+ };
+ try expectEqualDeep(Vec2{}, @as(Vec2, @import("zon/vec2.zon")));
+ }
+
+ // Test allowing comptime tuple fields to be set to their defaults
+ {
+ const Tuple = struct {
+ f32,
+ bool,
+ []const u8,
+ u16,
+ comptime u8 = 255,
+ };
+ try expectEqualDeep(Tuple{ 1.2, true, "hello", 3 }, @as(Tuple, @import("zon/tuple.zon")));
+ }
+
+ // Test allowing comptime struct fields to be set to their defaults
+ {
+ const Vec2 = struct {
+ comptime x: f32 = 1.5,
+ comptime y: f32 = 2.0,
+ };
+ try expectEqualDeep(Vec2{}, @as(Vec2, @import("zon/slice-empty.zon")));
+ }
+}
+
+test "char" {
+ try expectEqual(@as(u8, 'a'), @as(u8, @import("zon/a.zon")));
+ try expectEqual(@as(u8, 'z'), @as(u8, @import("zon/z.zon")));
+}
+
+test "arrays" {
+ try expectEqual([0]u8{}, @as([0]u8, @import("zon/vec0.zon")));
+ try expectEqual([0:1]u8{}, @as([0:1]u8, @import("zon/vec0.zon")));
+ try expectEqual(1, @as([0:1]u8, @import("zon/vec0.zon"))[0]);
+ try expectEqual([4]u8{ 'a', 'b', 'c', 'd' }, @as([4]u8, @import("zon/array.zon")));
+ try expectEqual([4:2]u8{ 'a', 'b', 'c', 'd' }, @as([4:2]u8, @import("zon/array.zon")));
+ try expectEqual(2, @as([4:2]u8, @import("zon/array.zon"))[4]);
+}
+
+test "slices, arrays, tuples" {
+ {
+ const expected_slice: []const u8 = &.{};
+ const found_slice: []const u8 = @import("zon/slice-empty.zon");
+ try expectEqualSlices(u8, expected_slice, found_slice);
+
+ const expected_array: [0]u8 = .{};
+ const found_array: [0]u8 = @import("zon/slice-empty.zon");
+ try expectEqual(expected_array, found_array);
+
+ const T = struct {};
+ const expected_tuple: T = .{};
+ const found_tuple: T = @import("zon/slice-empty.zon");
+ try expectEqual(expected_tuple, found_tuple);
+ }
+
+ {
+ const expected_slice: []const u8 = &.{1};
+ const found_slice: []const u8 = @import("zon/slice1_no_newline.zon");
+ try expectEqualSlices(u8, expected_slice, found_slice);
+
+ const expected_array: [1]u8 = .{1};
+ const found_array: [1]u8 = @import("zon/slice1_no_newline.zon");
+ try expectEqual(expected_array, found_array);
+
+ const T = struct { u8 };
+ const expected_tuple: T = .{1};
+ const found_tuple: T = @import("zon/slice1_no_newline.zon");
+ try expectEqual(expected_tuple, found_tuple);
+ }
+
+ {
+ const expected_slice: []const u8 = &.{ 'a', 'b', 'c' };
+ const found_slice: []const u8 = @import("zon/slice-abc.zon");
+ try expectEqualSlices(u8, expected_slice, found_slice);
+
+ const expected_array: [3]u8 = .{ 'a', 'b', 'c' };
+ const found_array: [3]u8 = @import("zon/slice-abc.zon");
+ try expectEqual(expected_array, found_array);
+
+ const T = struct { u8, u8, u8 };
+ const expected_tuple: T = .{ 'a', 'b', 'c' };
+ const found_tuple: T = @import("zon/slice-abc.zon");
+ try expectEqual(expected_tuple, found_tuple);
+ }
+}
+
+test "string literals" {
+ try expectEqualSlices(u8, "abc", @import("zon/abc.zon"));
+ try expectEqualSlices(u8, "ab\\c", @import("zon/abc-escaped.zon"));
+ const zero_terminated: [:0]const u8 = @import("zon/abc.zon");
+ try expectEqualDeep(zero_terminated, "abc");
+ try expectEqual(0, zero_terminated[zero_terminated.len]);
+ try expectEqualStrings(
+ \\Hello, world!
+ \\This is a multiline string!
+ \\ There are no escapes, we can, for example, include \n in the string
+ , @import("zon/multiline_string.zon"));
+ try expectEqualStrings("a\nb\x00c", @import("zon/string_embedded_null.zon"));
+}
+
+test "enum literals" {
+ const Enum = enum {
+ foo,
+ bar,
+ baz,
+ @"0\na",
+ };
+ try expectEqual(Enum.foo, @as(Enum, @import("zon/foo.zon")));
+ try expectEqual(.foo, @as(@TypeOf(.foo), @import("zon/foo.zon")));
+ try expectEqual(Enum.@"0\na", @as(Enum, @import("zon/escaped_enum.zon")));
+}
+
+test "int" {
+ const T = struct {
+ u8,
+ i16,
+ i14,
+ i32,
+ i8,
+ i8,
+ u8,
+ u8,
+ u65,
+ u65,
+ i128,
+ i128,
+ i66,
+ i66,
+ i8,
+ i8,
+ i16,
+ i16,
+ i16,
+ i16,
+ i16,
+ i16,
+ u65,
+ i66,
+ i66,
+ u65,
+ i66,
+ i66,
+ u65,
+ i66,
+ i66,
+ };
+ const expected: T = .{
+ // Test various numbers and types
+ 10,
+ 24,
+ -4,
+ -123,
+
+ // Test limits
+ 127,
+ -128,
+
+ // Test characters
+ 'a',
+ 'z',
+
+ // Test big integers
+ 36893488147419103231,
+ 36893488147419103231,
+ -18446744073709551615, // Only a big int due to negation
+ -9223372036854775809, // Only a big int due to negation
+
+ // Test big integer limits
+ 36893488147419103231,
+ -36893488147419103232,
+
+ // Test parsing whole number floats as integers
+ -1,
+ 123,
+
+ // Test non-decimal integers
+ 0xff,
+ -0xff,
+ 0o77,
+ -0o77,
+ 0b11,
+ -0b11,
+
+ // Test non-decimal big integers
+ 0x1ffffffffffffffff,
+ 0x1ffffffffffffffff,
+ -0x1ffffffffffffffff,
+ 0x1ffffffffffffffff,
+ 0x1ffffffffffffffff,
+ -0x1ffffffffffffffff,
+ 0x1ffffffffffffffff,
+ 0x1ffffffffffffffff,
+ -0x1ffffffffffffffff,
+ };
+ const actual: T = @import("zon/ints.zon");
+ try expectEqual(expected, actual);
+}
+
+test "floats" {
+ const T = struct {
+ f16,
+ f32,
+ f64,
+ f128,
+ f16,
+ f16,
+ f32,
+ f32,
+ f32,
+ f32,
+ f32,
+ f32,
+ f128,
+ f32,
+ f32,
+ f32,
+ f32,
+ f32,
+ };
+ const expected: T = .{
+ // Test decimals
+ 0.5,
+ 123.456,
+ -123.456,
+ 42.5,
+
+ // Test whole numbers with and without decimals
+ 5.0,
+ 5.0,
+ -102,
+ -102,
+
+ // Test characters and negated characters
+ 'a',
+ 'z',
+
+ // Test big integers
+ 36893488147419103231,
+ -36893488147419103231,
+ 0x1ffffffffffffffff,
+ 0x1ffffffffffffffff,
+
+ // Exponents, underscores
+ 123.0E+77,
+
+ // Hexadecimal
+ 0x103.70p-5,
+ -0x103.70,
+ 0x1234_5678.9ABC_CDEFp-10,
+ };
+ const actual: T = @import("zon/floats.zon");
+ try expectEqual(expected, actual);
+}
+
+test "inf and nan" {
+ // f32
+ {
+ const actual: struct { f32, f32, f32 } = @import("zon/inf_and_nan.zon");
+ try expect(std.math.isNan(actual[0]));
+ try expect(std.math.isPositiveInf(actual[1]));
+ try expect(std.math.isNegativeInf(actual[2]));
+ }
+
+ // f128
+ {
+ const actual: struct { f128, f128, f128 } = @import("zon/inf_and_nan.zon");
+ try expect(std.math.isNan(actual[0]));
+ try expect(std.math.isPositiveInf(actual[1]));
+ try expect(std.math.isNegativeInf(actual[2]));
+ }
+}
+
+test "vector" {
+ {
+ const actual: @Vector(0, bool) = @import("zon/vec0.zon");
+ const expected: @Vector(0, bool) = .{};
+ try expectEqual(expected, actual);
+ }
+ {
+ const actual: @Vector(3, bool) = @import("zon/vec3_bool.zon");
+ const expected: @Vector(3, bool) = .{ false, false, true };
+ try expectEqual(expected, actual);
+ }
+
+ {
+ const actual: @Vector(0, f32) = @import("zon/vec0.zon");
+ const expected: @Vector(0, f32) = .{};
+ try expectEqual(expected, actual);
+ }
+ {
+ const actual: @Vector(3, f32) = @import("zon/vec3_float.zon");
+ const expected: @Vector(3, f32) = .{ 1.5, 2.5, 3.5 };
+ try expectEqual(expected, actual);
+ }
+
+ {
+ const actual: @Vector(0, u8) = @import("zon/vec0.zon");
+ const expected: @Vector(0, u8) = .{};
+ try expectEqual(expected, actual);
+ }
+ {
+ const actual: @Vector(3, u8) = @import("zon/vec3_int.zon");
+ const expected: @Vector(3, u8) = .{ 2, 4, 6 };
+ try expectEqual(expected, actual);
+ }
+
+ {
+ const actual: @Vector(0, *const u8) = @import("zon/vec0.zon");
+ const expected: @Vector(0, *const u8) = .{};
+ try expectEqual(expected, actual);
+ }
+ {
+ const actual: @Vector(3, *const u8) = @import("zon/vec3_int.zon");
+ const expected: @Vector(3, *const u8) = .{ &2, &4, &6 };
+ try expectEqual(expected, actual);
+ }
+
+ {
+ const actual: @Vector(0, ?*const u8) = @import("zon/vec0.zon");
+ const expected: @Vector(0, ?*const u8) = .{};
+ try expectEqual(expected, actual);
+ }
+ {
+ const actual: @Vector(3, ?*const u8) = @import("zon/vec3_int_opt.zon");
+ const expected: @Vector(3, ?*const u8) = .{ &2, null, &6 };
+ try expectEqual(expected, actual);
+ }
+}
+
+test "pointers" {
+ // Primitive with varying levels of pointers
+ try expectEqual(@as(u8, 'a'), @as(*const u8, @import("zon/a.zon")).*);
+ try expectEqual(@as(u8, 'a'), @as(*const *const u8, @import("zon/a.zon")).*.*);
+ try expectEqual(@as(u8, 'a'), @as(*const *const *const u8, @import("zon/a.zon")).*.*.*);
+
+ // Primitive optional with varying levels of pointers
+ try expectEqual(@as(u8, 'a'), @as(?*const u8, @import("zon/a.zon")).?.*);
+ try expectEqual(null, @as(?*const u8, @import("zon/none.zon")));
+
+ try expectEqual(@as(u8, 'a'), @as(*const ?u8, @import("zon/a.zon")).*.?);
+ try expectEqual(null, @as(*const ?u8, @import("zon/none.zon")).*);
+
+ try expectEqual(@as(u8, 'a'), @as(?*const *const u8, @import("zon/a.zon")).?.*.*);
+ try expectEqual(null, @as(?*const *const u8, @import("zon/none.zon")));
+
+ try expectEqual(@as(u8, 'a'), @as(*const ?*const u8, @import("zon/a.zon")).*.?.*);
+ try expectEqual(null, @as(*const ?*const u8, @import("zon/none.zon")).*);
+
+ try expectEqual(@as(u8, 'a'), @as(*const *const ?u8, @import("zon/a.zon")).*.*.?);
+ try expectEqual(null, @as(*const *const ?u8, @import("zon/none.zon")).*.*);
+
+ try expectEqual([3]u8{ 2, 4, 6 }, @as(*const [3]u8, @import("zon/vec3_int.zon")).*);
+
+ // A complicated type with nested internal pointers and string allocations
+ {
+ const Inner = struct {
+ f1: *const ?*const []const u8,
+ f2: *const ?*const []const u8,
+ };
+ const Outer = struct {
+ f1: *const ?*const Inner,
+ f2: *const ?*const Inner,
+ };
+ const expected: Outer = .{
+ .f1 = &&.{
+ .f1 = &null,
+ .f2 = &&"foo",
+ },
+ .f2 = &null,
+ };
+
+ const found: ?*const Outer = @import("zon/complex.zon");
+ try std.testing.expectEqualDeep(expected, found.?.*);
+ }
+}
+
+test "recursive" {
+ const Recursive = struct { foo: ?*const @This() };
+ const expected: Recursive = .{ .foo = &.{ .foo = null } };
+ try expectEqualDeep(expected, @as(Recursive, @import("zon/recursive.zon")));
+}
diff --git a/test/behavior/zon/a.zon b/test/behavior/zon/a.zon
new file mode 100644
index 0000000000..67fe32dafe
--- /dev/null
+++ b/test/behavior/zon/a.zon
@@ -0,0 +1 @@
+'a'
diff --git a/test/behavior/zon/abc-escaped.zon b/test/behavior/zon/abc-escaped.zon
new file mode 100644
index 0000000000..8672bb9448
--- /dev/null
+++ b/test/behavior/zon/abc-escaped.zon
@@ -0,0 +1 @@
+"ab\\c"
diff --git a/test/behavior/zon/abc.zon b/test/behavior/zon/abc.zon
new file mode 100644
index 0000000000..d1cc1b4e52
--- /dev/null
+++ b/test/behavior/zon/abc.zon
@@ -0,0 +1 @@
+"abc"
diff --git a/test/behavior/zon/array.zon b/test/behavior/zon/array.zon
new file mode 100644
index 0000000000..8ee5ebe0f5
--- /dev/null
+++ b/test/behavior/zon/array.zon
@@ -0,0 +1 @@
+.{ 'a', 'b', 'c', 'd' }
diff --git a/test/behavior/zon/complex.zon b/test/behavior/zon/complex.zon
new file mode 100644
index 0000000000..0d61c25517
--- /dev/null
+++ b/test/behavior/zon/complex.zon
@@ -0,0 +1,7 @@
+.{
+ .f1 = .{
+ .f1 = null,
+ .f2 = "foo",
+ },
+ .f2 = null,
+}
diff --git a/test/behavior/zon/enum_field.zon b/test/behavior/zon/enum_field.zon
new file mode 100644
index 0000000000..33011e2f65
--- /dev/null
+++ b/test/behavior/zon/enum_field.zon
@@ -0,0 +1 @@
+.{ .x = .z }
diff --git a/test/behavior/zon/escaped_enum.zon b/test/behavior/zon/escaped_enum.zon
new file mode 100644
index 0000000000..14e46d587c
--- /dev/null
+++ b/test/behavior/zon/escaped_enum.zon
@@ -0,0 +1 @@
+.@"0\na"
diff --git a/test/behavior/zon/escaped_struct.zon b/test/behavior/zon/escaped_struct.zon
new file mode 100644
index 0000000000..f304aa6327
--- /dev/null
+++ b/test/behavior/zon/escaped_struct.zon
@@ -0,0 +1,2 @@
+
+.{ .@"0" = 1.5, .@"foo" = 2 }
diff --git a/test/behavior/zon/false.zon b/test/behavior/zon/false.zon
new file mode 100644
index 0000000000..0064d7bc7d
--- /dev/null
+++ b/test/behavior/zon/false.zon
@@ -0,0 +1,4 @@
+// Comment
+false // Another comment
+// Yet another comment
+
diff --git a/test/behavior/zon/floats.zon b/test/behavior/zon/floats.zon
new file mode 100644
index 0000000000..052e348989
--- /dev/null
+++ b/test/behavior/zon/floats.zon
@@ -0,0 +1,25 @@
+.{
+ 0.5,
+ 123.456,
+ -123.456,
+ 42.5,
+
+ 5.0,
+ 5,
+ -102.0,
+ -102,
+
+ 'a',
+ 'z',
+
+ 36893488147419103231,
+ -36893488147419103231,
+ 0x1ffffffffffffffff,
+ 0x1ffffffffffffffff,
+
+ 12_3.0E+77,
+
+ 0x103.70p-5,
+ -0x103.70,
+ 0x1234_5678.9ABC_CDEFp-10,
+}
diff --git a/test/behavior/zon/foo.zon b/test/behavior/zon/foo.zon
new file mode 100644
index 0000000000..1e8ea91de5
--- /dev/null
+++ b/test/behavior/zon/foo.zon
@@ -0,0 +1 @@
+.foo
diff --git a/test/behavior/zon/inf_and_nan.zon b/test/behavior/zon/inf_and_nan.zon
new file mode 100644
index 0000000000..dec18d858a
--- /dev/null
+++ b/test/behavior/zon/inf_and_nan.zon
@@ -0,0 +1,5 @@
+.{
+ nan,
+ inf,
+ -inf,
+}
diff --git a/test/behavior/zon/ints.zon b/test/behavior/zon/ints.zon
new file mode 100644
index 0000000000..fb1060324e
--- /dev/null
+++ b/test/behavior/zon/ints.zon
@@ -0,0 +1,40 @@
+.{
+ 10,
+ 24,
+ -4,
+ -123,
+
+ 127,
+ -128,
+
+ 'a',
+ 'z',
+
+ 36893488147419103231,
+ 368934_881_474191032_31,
+ -18446744073709551615,
+ -9223372036854775809,
+
+ 36893488147419103231,
+ -36893488147419103232,
+
+ -1.0,
+ 123.0,
+
+ 0xff,
+ -0xff,
+ 0o77,
+ -0o77,
+ 0b11,
+ -0b11,
+
+ 0x1ffffffffffffffff,
+ 0x1ffffffffffffffff,
+ -0x1ffffffffffffffff,
+ 0o3777777777777777777777,
+ 0o3777777777777777777777,
+ -0o3777777777777777777777,
+ 0b11111111111111111111111111111111111111111111111111111111111111111,
+ 0b11111111111111111111111111111111111111111111111111111111111111111,
+ -0b11111111111111111111111111111111111111111111111111111111111111111,
+}
diff --git a/test/behavior/zon/multiline_string.zon b/test/behavior/zon/multiline_string.zon
new file mode 100644
index 0000000000..5908802ecc
--- /dev/null
+++ b/test/behavior/zon/multiline_string.zon
@@ -0,0 +1,4 @@
+// zig fmt: off
+ \\Hello, world!
+\\This is a multiline string!
+ \\ There are no escapes, we can, for example, include \n in the string
diff --git a/test/behavior/zon/none.zon b/test/behavior/zon/none.zon
new file mode 100644
index 0000000000..19765bd501
--- /dev/null
+++ b/test/behavior/zon/none.zon
@@ -0,0 +1 @@
+null
diff --git a/test/behavior/zon/recursive.zon b/test/behavior/zon/recursive.zon
new file mode 100644
index 0000000000..063bf84915
--- /dev/null
+++ b/test/behavior/zon/recursive.zon
@@ -0,0 +1 @@
+.{ .foo = .{ .foo = null } }
diff --git a/test/behavior/zon/slice-abc.zon b/test/behavior/zon/slice-abc.zon
new file mode 100644
index 0000000000..e033b2e6ff
--- /dev/null
+++ b/test/behavior/zon/slice-abc.zon
@@ -0,0 +1 @@
+.{'a', 'b', 'c'} \ No newline at end of file
diff --git a/test/behavior/zon/slice-empty.zon b/test/behavior/zon/slice-empty.zon
new file mode 100644
index 0000000000..c1ab9cdd50
--- /dev/null
+++ b/test/behavior/zon/slice-empty.zon
@@ -0,0 +1 @@
+.{} \ No newline at end of file
diff --git a/test/behavior/zon/slice1_no_newline.zon b/test/behavior/zon/slice1_no_newline.zon
new file mode 100644
index 0000000000..7714116d45
--- /dev/null
+++ b/test/behavior/zon/slice1_no_newline.zon
@@ -0,0 +1 @@
+.{ 1 } \ No newline at end of file
diff --git a/test/behavior/zon/some.zon b/test/behavior/zon/some.zon
new file mode 100644
index 0000000000..f599e28b8a
--- /dev/null
+++ b/test/behavior/zon/some.zon
@@ -0,0 +1 @@
+10
diff --git a/test/behavior/zon/string_embedded_null.zon b/test/behavior/zon/string_embedded_null.zon
new file mode 100644
index 0000000000..4203166364
--- /dev/null
+++ b/test/behavior/zon/string_embedded_null.zon
@@ -0,0 +1 @@
+"a\nb\x00c"
diff --git a/test/behavior/zon/true.zon b/test/behavior/zon/true.zon
new file mode 100644
index 0000000000..27ba77ddaf
--- /dev/null
+++ b/test/behavior/zon/true.zon
@@ -0,0 +1 @@
+true
diff --git a/test/behavior/zon/tuple.zon b/test/behavior/zon/tuple.zon
new file mode 100644
index 0000000000..61e6be9fcf
--- /dev/null
+++ b/test/behavior/zon/tuple.zon
@@ -0,0 +1 @@
+.{ 1.2, true, "hello", 3 }
diff --git a/test/behavior/zon/union1.zon b/test/behavior/zon/union1.zon
new file mode 100644
index 0000000000..3dc052f892
--- /dev/null
+++ b/test/behavior/zon/union1.zon
@@ -0,0 +1 @@
+.{ .x = 1.5 }
diff --git a/test/behavior/zon/union2.zon b/test/behavior/zon/union2.zon
new file mode 100644
index 0000000000..5c25d15690
--- /dev/null
+++ b/test/behavior/zon/union2.zon
@@ -0,0 +1 @@
+.{ .y = true }
diff --git a/test/behavior/zon/union3.zon b/test/behavior/zon/union3.zon
new file mode 100644
index 0000000000..3baf4ac173
--- /dev/null
+++ b/test/behavior/zon/union3.zon
@@ -0,0 +1 @@
+.z
diff --git a/test/behavior/zon/vec0.zon b/test/behavior/zon/vec0.zon
new file mode 100644
index 0000000000..47c47bc057
--- /dev/null
+++ b/test/behavior/zon/vec0.zon
@@ -0,0 +1 @@
+.{}
diff --git a/test/behavior/zon/vec1.zon b/test/behavior/zon/vec1.zon
new file mode 100644
index 0000000000..3dc052f892
--- /dev/null
+++ b/test/behavior/zon/vec1.zon
@@ -0,0 +1 @@
+.{ .x = 1.5 }
diff --git a/test/behavior/zon/vec2.zon b/test/behavior/zon/vec2.zon
new file mode 100644
index 0000000000..cc4bff59b9
--- /dev/null
+++ b/test/behavior/zon/vec2.zon
@@ -0,0 +1 @@
+.{ .x = 1.5, .y = 2 }
diff --git a/test/behavior/zon/vec3_bool.zon b/test/behavior/zon/vec3_bool.zon
new file mode 100644
index 0000000000..53aff97419
--- /dev/null
+++ b/test/behavior/zon/vec3_bool.zon
@@ -0,0 +1 @@
+.{ false, false, true }
diff --git a/test/behavior/zon/vec3_float.zon b/test/behavior/zon/vec3_float.zon
new file mode 100644
index 0000000000..a0e225db09
--- /dev/null
+++ b/test/behavior/zon/vec3_float.zon
@@ -0,0 +1 @@
+.{ 1.5, 2.5, 3.5 }
diff --git a/test/behavior/zon/vec3_int.zon b/test/behavior/zon/vec3_int.zon
new file mode 100644
index 0000000000..210cd1a2d6
--- /dev/null
+++ b/test/behavior/zon/vec3_int.zon
@@ -0,0 +1 @@
+.{ 2, 4, 6 }
diff --git a/test/behavior/zon/vec3_int_opt.zon b/test/behavior/zon/vec3_int_opt.zon
new file mode 100644
index 0000000000..9c009b99d6
--- /dev/null
+++ b/test/behavior/zon/vec3_int_opt.zon
@@ -0,0 +1 @@
+.{ 2, null, 6 }
diff --git a/test/behavior/zon/z.zon b/test/behavior/zon/z.zon
new file mode 100644
index 0000000000..6ad22b40ef
--- /dev/null
+++ b/test/behavior/zon/z.zon
@@ -0,0 +1 @@
+'z'