Skip to content

Commit b3cc3a3

Browse files
authored
Merge pull request #39 from sencrash/main
yaml-testsuite implementation
2 parents d6e89cf + 6816b03 commit b3cc3a3

File tree

5 files changed

+671
-0
lines changed

5 files changed

+671
-0
lines changed

.github/workflows/ci.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,20 @@ jobs:
2323
- run: zig fmt --check src
2424
- run: zig build test
2525
- run: zig build run
26+
27+
spec-test:
28+
name: YAML Test Suite
29+
runs-on: ${{ matrix.os }}-latest
30+
strategy:
31+
fail-fast: false
32+
matrix:
33+
os: [macos, ubuntu]
34+
35+
steps:
36+
- uses: actions/checkout@v2
37+
with:
38+
submodules: true
39+
- uses: mlugg/setup-zig@v1
40+
with:
41+
version: master
42+
- run: zig build test -Denable-spec-tests

.gitmodules

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[submodule "test/yaml-test-suite"]
2+
path = test/yaml-test-suite
3+
url = https://github.com/yaml/yaml-test-suite.git
4+
branch = v2022-01-17

build.zig

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
const std = @import("std");
2+
const SpecTest = @import("test/spec.zig");
23

34
pub fn build(b: *std.Build) void {
45
const target = b.standardTargetOptions(.{});
@@ -48,4 +49,16 @@ pub fn build(b: *std.Build) void {
4849
});
4950
e2e_tests.root_module.addImport("yaml", yaml_module);
5051
test_step.dependOn(&b.addRunArtifact(e2e_tests).step);
52+
53+
const enable_spec_tests = b.option(bool, "enable-spec-tests", "Enable YAML Test Suite") orelse false;
54+
if (enable_spec_tests) {
55+
const gen = SpecTest.create(b);
56+
var spec_tests = b.addTest(.{
57+
.root_source_file = gen.path(),
58+
.target = target,
59+
.optimize = optimize,
60+
});
61+
spec_tests.root_module.addImport("yaml", yaml_module);
62+
test_step.dependOn(&b.addRunArtifact(spec_tests).step);
63+
}
5164
}

0 commit comments

Comments
 (0)