Skip to content

Commit

Permalink
better test case
Browse files Browse the repository at this point in the history
  • Loading branch information
pwbh committed Aug 31, 2024
1 parent da7932d commit 1ebdaf1
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
5 changes: 5 additions & 0 deletions resources/super_simple_with_optional.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ first: 500
name: just testing strings overhere # just a comment
fourth: 142.241
# comment in between lines
foods:
- Apple
- Orange
- Strawberry
- Mango
inner:
abcd: 12
k: 2
Expand Down
15 changes: 8 additions & 7 deletions src/root.zig
Original file line number Diff line number Diff line change
Expand Up @@ -644,6 +644,7 @@ test "should be able to to skip optional fields if non-existent in the parsed fi
name: []const u8,
fourth: f32,
foods: ?[][]const u8,
more_fiids: ?[][]const u8,
};

const yml_file_location = try std.fs.cwd().realpathAlloc(
Expand All @@ -661,12 +662,12 @@ test "should be able to to skip optional fields if non-existent in the parsed fi
try expect(std.mem.eql(u8, result.name, "just testing strings overhere"));
try expect(result.fourth == 142.241);

// const foods = result.foods.?;
// try expect(foods.len == 4);
// try expect(std.mem.eql(u8, foods[0], "Apple"));
// try expect(std.mem.eql(u8, foods[1], "Orange"));
// try expect(std.mem.eql(u8, foods[2], "Strawberry"));
// try expect(std.mem.eql(u8, foods[3], "Mango"));
const foods = result.foods.?;
try expect(foods.len == 4);
try expect(std.mem.eql(u8, foods[0], "Apple"));
try expect(std.mem.eql(u8, foods[1], "Orange"));
try expect(std.mem.eql(u8, foods[2], "Strawberry"));
try expect(std.mem.eql(u8, foods[3], "Mango"));

try expect(result.foods == null);
try expect(result.more_fiids == null);
}

0 comments on commit 1ebdaf1

Please sign in to comment.