Skip to content

Commit

Permalink
Merge pull request #39 from sencrash/main
Browse files Browse the repository at this point in the history
yaml-testsuite implementation
  • Loading branch information
kubkon authored Dec 20, 2024
2 parents d6e89cf + 6816b03 commit b3cc3a3
Show file tree
Hide file tree
Showing 5 changed files with 671 additions and 0 deletions.
17 changes: 17 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,20 @@ jobs:
- run: zig fmt --check src
- run: zig build test
- run: zig build run

spec-test:
name: YAML Test Suite
runs-on: ${{ matrix.os }}-latest
strategy:
fail-fast: false
matrix:
os: [macos, ubuntu]

steps:
- uses: actions/checkout@v2
with:
submodules: true
- uses: mlugg/setup-zig@v1
with:
version: master
- run: zig build test -Denable-spec-tests
4 changes: 4 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[submodule "test/yaml-test-suite"]
path = test/yaml-test-suite
url = https://github.com/yaml/yaml-test-suite.git
branch = v2022-01-17
13 changes: 13 additions & 0 deletions build.zig
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const std = @import("std");
const SpecTest = @import("test/spec.zig");

pub fn build(b: *std.Build) void {
const target = b.standardTargetOptions(.{});
Expand Down Expand Up @@ -48,4 +49,16 @@ pub fn build(b: *std.Build) void {
});
e2e_tests.root_module.addImport("yaml", yaml_module);
test_step.dependOn(&b.addRunArtifact(e2e_tests).step);

const enable_spec_tests = b.option(bool, "enable-spec-tests", "Enable YAML Test Suite") orelse false;
if (enable_spec_tests) {
const gen = SpecTest.create(b);
var spec_tests = b.addTest(.{
.root_source_file = gen.path(),
.target = target,
.optimize = optimize,
});
spec_tests.root_module.addImport("yaml", yaml_module);
test_step.dependOn(&b.addRunArtifact(spec_tests).step);
}
}
Loading

0 comments on commit b3cc3a3

Please sign in to comment.