-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Start adding more tests and find more edge cases
- Loading branch information
Showing
3 changed files
with
47 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
elemennts: | ||
- name: Spec Example 5.5. Comment Indicator | ||
from: http://www.yaml.org/spec/1.2/spec.html#id2773032 | ||
tags: spec comment empty | ||
yaml: | | ||
# Comment only. | ||
tree: | | ||
+STR | ||
-STR | ||
json: "" | ||
dump: "" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
const std = @import("std"); | ||
|
||
const expect = std.testing.expect; | ||
|
||
const Ymlz = @import("root.zig").Ymlz; | ||
|
||
test "98YD" { | ||
const Element = struct { | ||
name: []const u8, | ||
from: []const u8, | ||
tags: []const u8, | ||
yaml: []const u8, | ||
tree: []const u8, | ||
json: []const u8, | ||
dump: []const u8, | ||
}; | ||
|
||
const Experiment = struct { | ||
elements: []Element, | ||
}; | ||
|
||
const yml_file_location = try std.fs.cwd().realpathAlloc( | ||
std.testing.allocator, | ||
"./resources/yaml-test-suite/98YD.yml", | ||
); | ||
defer std.testing.allocator.free(yml_file_location); | ||
|
||
var ymlz = try Ymlz(Experiment).init(std.testing.allocator); | ||
const result = try ymlz.loadFile(yml_file_location); | ||
defer ymlz.deinit(result); | ||
|
||
try expect(std.mem.eql(u8, result.elements[0].name, "Spec Example 5.5. Comment Indicator")); | ||
} |