fix: build of helix_mode tests

This commit is contained in:
CJ van den Berg 2025-10-08 14:16:09 +02:00
parent a64d7c3afa
commit a5dc6d8a43
3 changed files with 11 additions and 66 deletions

View file

@ -621,67 +621,6 @@ pub fn build_exe(
},
});
const helix_mod = b.createModule(.{
.root_source_file = b.path("src/tui/mode/helix.zig"),
});
// const editor_mod = b.createModule(.{
// .root_source_file = b.path("src/tui/editor.zig"),
// });
// const Widget_mod = b.createModule(.{
// .root_source_file = b.path("src/tui/Widget.zig"),
// });
// const mainview_mod = b.createModule(.{
// .root_source_file = b.path("src/tui/mainview.zig"),
// });
// const WidgetList_mod = b.createModule(.{
// .root_source_file = b.path("src/tui/WidgetList.zig"),
// });
// const MessageFilter_mod = b.createModule(.{
// .root_source_file = b.path("src/tui/MessageFilter.zig"),
// });
// const editor_gutter_mod = b.createModule(.{
// .root_source_file = b.path("src/tui/editor_gutter.zig"),
// });
// const scrollbar_v_mod = b.createModule(.{
// .root_source_file = b.path("src/tui//scrollbar_v.zig"),
// });
// const palette_mod = b.createModule(.{
// .root_source_file = b.path("src/tui/mode/overlay/palette.zig"),
// });
// const open_recent_project_mod = b.createModule(.{
// .root_source_file = b.path("src/tui/mode/overlay/open_recent_project.zig"),
// });
// const helix_test_run_cmd = blk: {
// const tests = b.addTest(.{
// .root_module = b.createModule(.{
// .root_source_file = b.path("src/tui/mode/helix.zig"),
// .target = target,
// .optimize = optimize,
// }),
// });
// tests.root_module.addImport("cbor", cbor_mod);
// tests.root_module.addImport("command", command_mod);
// tests.root_module.addImport("EventHandler", EventHandler_mod);
// tests.root_module.addImport("input", input_mod);
// tests.root_module.addImport("thespian", thespian_mod);
// tests.root_module.addImport("log", log_mod);
// tests.root_module.addImport("tui", tui_mod);
// tests.root_module.addImport("helix", helix_mod);
// tests.root_module.addImport("editor", editor_mod);
// tests.root_module.addImport("Widget", Widget_mod);
// tests.root_module.addImport("WidgetList", WidgetList_mod);
// tests.root_module.addImport("mainview", mainview_mod);
// tests.root_module.addImport("Buffer", Buffer_mod);
// tests.root_module.addImport("MessageFilter", MessageFilter_mod);
// tests.root_module.addImport("editor_gutter", editor_gutter_mod);
// tests.root_module.addImport("scrollbar_v", scrollbar_v_mod);
// tests.root_module.addImport("palette", palette_mod);
// tests.root_module.addImport("open_recent_project", open_recent_project_mod);
// tests.root_module.addImport("renderer", renderer_mod);
// break :blk b.addRunArtifact(tests);
// };
const exe_name = if (gui) "flow-gui" else "flow";
const exe = b.addExecutable(.{
@ -793,7 +732,7 @@ pub fn build_exe(
tests.root_module.addImport("log", log_mod);
tests.root_module.addImport("Buffer", Buffer_mod);
tests.root_module.addImport("color", color_mod);
tests.root_module.addImport("helix", helix_mod);
tests.root_module.addImport("tui", tui_mod);
// b.installArtifact(tests);
const test_run_cmd = b.addRunArtifact(tests);

View file

@ -19,6 +19,14 @@ const Widget = @import("Widget.zig");
const MessageFilter = @import("MessageFilter.zig");
const MainView = @import("mainview.zig");
// exports for unittesting
pub const exports = struct {
pub const mode = struct {
pub const helix = @import("mode/helix.zig");
};
pub const editor = @import("editor.zig");
};
const Allocator = std.mem.Allocator;
allocator: Allocator,

View file

@ -1,10 +1,8 @@
const std = @import("std");
const Buffer = @import("Buffer");
const Cursor = @import("Cursor");
const helix = @import("helix");
const Cursor = @import("Buffer").Cursor;
// error: import of file outside module path
// const helix = @import("../src/tui/mode/helix.zig");
const helix = @import("tui").exports.mode.helix;
const ArrayList = std.ArrayList;
const a = std.testing.allocator;