zig-toybox/src/test.zig

27 lines
724 B
Zig

const std = @import("std");
const path = std.fs.path;
const lib = @import("./lib.zig");
const fmt = std.fmt;
const default_max_depth = 3;
test "print type" {
lib.print("hello\n", .{});
var buffer = [_]u8{0} ** 3;
const T = @TypeOf(std.io.fixedBufferStream(&buffer));
lib.print("hello: {}\n", .{T});
}
test "buffer stuff" {
var buffer = [_]u8 {0} ** (std.fs.MAX_PATH_BYTES + 100);
var fbs = std.io.fixedBufferStream(&buffer);
var writer = fbs.writer();
try fmt.formatType('W', "c", fmt.FormatOptions{}, writer, default_max_depth);
try fmt.formatType("ritten", "s", fmt.FormatOptions{}, writer, default_max_depth);
lib.print("{s}\n", .{fbs.getWritten()});
fbs.reset();
}