Skip to content

Commit

Permalink
more fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
pwbh committed Sep 7, 2024
1 parent 7146a0a commit d4818ed
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 1 addition & 5 deletions src/root.zig
Original file line number Diff line number Diff line change
Expand Up @@ -293,12 +293,8 @@ pub fn Ymlz(comptime Destination: type) type {
if (raw_line) |line| {
try self.allocations.append(line);

if (line.len == 0) {
return "\n";
}

// TODO: Need to fix this comments can start not only from index 0.
if (line[0] == '#') {
if (line.len == 0 or line[0] == '#') {
// Skipping comments
return self.readLine();
}
Expand Down
6 changes: 5 additions & 1 deletion src/tests.zig
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ test "CC74" {
const element = result.elements[0];

try expect(std.mem.eql(u8, element.name, "Spec Example 6.20. Tag Handles"));
try expect(std.mem.eql(u8, element.tree, "+STR\n +DOC ---\n =VAL <tag:example.com,2000:app/foo> \"bar\n -DOC\n-STR"));
try expect(std.mem.eql(u8, element.dump, "--- !<tag:example.com,2000:app/foo> \"bar\"\n"));
}

Expand Down Expand Up @@ -92,5 +93,8 @@ test "F6MC" {
const result = try ymlz.loadFile(yml_file_location);
defer ymlz.deinit(result);

try expect(std.mem.eql(u8, result.elements[0].name, "More indented lines at the beginning of folded block scalars"));
const element = result.elements[0];

try expect(std.mem.eql(u8, element.name, "More indented lines at the beginning of folded block scalars"));
try expect(std.mem.eql(u8, element.json, "{\n \"a\": \" more indented\\nregular\\n\",\n \"b\": \"\\n\\n more indented\\nregular\\n\"\n}"));
}

0 comments on commit d4818ed

Please sign in to comment.