From 1ebdaf106e98215f6dd4bb007a5d189ea2379a7d Mon Sep 17 00:00:00 2001 From: pwbh Date: Sat, 31 Aug 2024 12:20:52 +0300 Subject: [PATCH] better test case --- resources/super_simple_with_optional.yml | 5 +++++ src/root.zig | 15 ++++++++------- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/resources/super_simple_with_optional.yml b/resources/super_simple_with_optional.yml index 7c863c3..0cef7a3 100644 --- a/resources/super_simple_with_optional.yml +++ b/resources/super_simple_with_optional.yml @@ -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 diff --git a/src/root.zig b/src/root.zig index 77935cf..bab4d7c 100644 --- a/src/root.zig +++ b/src/root.zig @@ -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( @@ -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); }