authorgravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2024-10-27 02:55:02 -07:00
committergravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2024-10-27 02:55:02 -07:00
log42bc1cb3dad77c9d3e010930ba634f7b53004fc4
treea28a1c46ec44b9bbda50bba6313226eda08ba456
parent0ab07cc0b39951f102e3e3c6525d265ef7f76e33

get JSONTestSuite_root from deps.zig so the suite can be run from anywhere


2 files changed, 7 insertions(+), 2 deletions(-)

build.zig+5
......@@ -1,4 +1,5 @@
11const std = @import("std");
2const string = []const u8;
23const deps = @import("./deps.zig");
34
45pub fn build(b: *std.Build) void {
......@@ -12,6 +13,10 @@ pub fn build(b: *std.Build) void {
1213 });
1314 deps.addAllTo(test_exe);
1415
16 const build_options = b.addOptions();
17 build_options.addOption(string, "JSONTestSuite_root", deps.dirs._bebdygynna6k ++ "/test_parsing");
18 test_exe.root_module.addImport("build_options", build_options.createModule());
19
1520 const test_cmd = b.addRunArtifact(test_exe);
1621 test_cmd.has_side_effects = true;
1722 test_cmd.step.dependOn(b.getInstallStep());
test.zig+2-2
......@@ -1,5 +1,7 @@
11const std = @import("std");
22const json = @import("json");
3const build_options = @import("build_options");
4const JSONTestSuite_root = build_options.JSONTestSuite_root;
35
46fn parse_full(buffer: []const u8) !void {
57 const alloc = std.testing.allocator;
......@@ -258,8 +260,6 @@ test {
258260 );
259261}
260262
261const JSONTestSuite_root = ".zigmod/deps/v/git/github.com/nst/JSONTestSuite/commit-984defc2deaa653cb73cd29f4144a720ec9efe7c/test_parsing";
262
263263fn expectPass(path: []const u8) !void {
264264 const alloc = std.testing.allocator;
265265 var file = try std.fs.cwd().openFile(path, .{});