~cricket/zckt

0c3963cc8155daa573a46ed311276fbeba419eab — c piapiac 3 months ago 6f63ef3 trunk
zig -> 0.8.0
2 files changed, 7 insertions(+), 7 deletions(-)

M parser.zig
M zckt.zig
M parser.zig => parser.zig +3 -3
@@ 246,8 246,8 @@ pub const table_parser = struct {
            var iter = self.map.iterator();

            while (iter.next()) |entry| {
                self.a.free(entry.key);
                entry.value.deinit(self.a);
                self.a.free(entry.key_ptr.*);
                entry.value_ptr.deinit(self.a);
            }

            self.map.deinit();


@@ 285,7 285,7 @@ pub const table_parser = struct {
        ) !void {
            try writer.print("[ ", .{});
            var iter = self.map.iterator();
            while (iter.next()) |entry| try writer.print("{s}={s};", .{ entry.key, entry.value });
            while (iter.next()) |entry| try writer.print("{s}={s};", .{ entry.key_ptr.*, entry.value_ptr.* });
            try writer.print(" ]", .{});
        }
    };

M zckt.zig => zckt.zig +4 -4
@@ 16,7 16,7 @@ test "key = [ table ]" {
    var table = try table_parser.parse(zckt, alloc);
    defer table.deinit();

    testing.expectEqualStrings(
    try testing.expectEqualStrings(
        "this is the second value",
        table.getTable("table").?.getString("1").?,
    );


@@ 33,7 33,7 @@ test "duplicate keys overwrite" {
    var table = try table_parser.parse(zckt, alloc);
    defer table.deinit();

    testing.expectEqualStrings("haha! overwritten", table.getString("key").?);
    try testing.expectEqualStrings("haha! overwritten", table.getString("key").?);
}

test "multiline string" {


@@ 54,7 54,7 @@ test "multiline string" {
    var table = try table_parser.parse(zckt, alloc);
    defer table.deinit();

    testing.expectEqualStrings(table.getString("multiline string").?, multiline_string);
    try testing.expectEqualStrings(table.getString("multiline string").?, multiline_string);
}

test "expect invalid" {


@@ 64,5 64,5 @@ test "expect invalid" {
    ;

    const table = table_parser.parse(zckt, alloc);
    testing.expectError(error.EmptyKey, table);
    try testing.expectError(error.EmptyKey, table);
}