You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.
ndg/src/sys.zig

29 lines
764 B
Zig

//! operating system related helper functions.
const builtin = @import("builtin");
const std = @import("std");
const types = @import("types.zig");
const sysimpl = @import("sys/sysimpl.zig");
pub const Service = @import("sys/Service.zig");
pub usingnamespace if (builtin.is_test) struct {
// stubs, mocks and overrides for testing.
pub fn hostname(allocator: std.mem.Allocator) ![]const u8 {
return allocator.dupe(u8, "testhost");
}
pub fn setHostname(allocator: std.mem.Allocator, name: []const u8) !void {
_ = allocator;
_ = name;
}
} else sysimpl; // real implementation for production code.
test {
_ = @import("sys/Service.zig");
_ = @import("sys/sysimpl.zig");
std.testing.refAllDecls(@This());
}