Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

yaml-testsuite implementation #39

Merged
merged 16 commits into from
Dec 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading