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 @@...@@ -1,4 +1,5 @@
1const std = @import("std");1const std = @import("std");
2const string = []const u8;
2const deps = @import("./deps.zig");3const deps = @import("./deps.zig");
34
4pub fn build(b: *std.Build) void {5pub fn build(b: *std.Build) void {
...@@ -12,6 +13,10 @@ pub fn build(b: *std.Build) void {...@@ -12,6 +13,10 @@ pub fn build(b: *std.Build) void {
12 });13 });
13 deps.addAllTo(test_exe);14 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
15 const test_cmd = b.addRunArtifact(test_exe);20 const test_cmd = b.addRunArtifact(test_exe);
16 test_cmd.has_side_effects = true;21 test_cmd.has_side_effects = true;
17 test_cmd.step.dependOn(b.getInstallStep());22 test_cmd.step.dependOn(b.getInstallStep());
test.zig+2-2
...@@ -1,5 +1,7 @@...@@ -1,5 +1,7 @@
1const std = @import("std");1const std = @import("std");
2const json = @import("json");2const json = @import("json");
3const build_options = @import("build_options");
4const JSONTestSuite_root = build_options.JSONTestSuite_root;
35
4fn parse_full(buffer: []const u8) !void {6fn parse_full(buffer: []const u8) !void {
5 const alloc = std.testing.allocator;7 const alloc = std.testing.allocator;
...@@ -258,8 +260,6 @@ test {...@@ -258,8 +260,6 @@ test {
258 );260 );
259}261}
260262
261const JSONTestSuite_root = ".zigmod/deps/v/git/github.com/nst/JSONTestSuite/commit-984defc2deaa653cb73cd29f4144a720ec9efe7c/test_parsing";
262
263fn expectPass(path: []const u8) !void {263fn expectPass(path: []const u8) !void {
264 const alloc = std.testing.allocator;264 const alloc = std.testing.allocator;
265 var file = try std.fs.cwd().openFile(path, .{});265 var file = try std.fs.cwd().openFile(path, .{});