Backlog/engine/sys/tests/tests.zig

27 lines
858 B
Zig

const sys = @import("sys");
const core = sys.core;
const std = @import("std");
test "testing threadrunner" {
var spec = core.SpecVariantMap.init(std.testing.allocator);
try spec.put("name", .{ .string = "test" });
defer spec.deinit();
try core.start_module(&spec, .{}, std.testing.allocator);
defer core.shutdown_module(std.testing.allocator);
try sys.start_module(&spec, .{}, std.testing.allocator);
defer sys.shutdown_module(std.testing.allocator);
const task = try sys.SubprocessTask.create(std.testing.allocator, &.{ "echo", "this is an echo: hello world\n" });
defer task.destroy();
std.debug.print("beginning destroy\n", .{});
try task.run();
task.wait();
const task2 = try sys.runCommand(std.testing.allocator, &.{ "echo", "sup homies" }, null);
defer task2.destroy();
task2.wait();
}