fix tests

This commit is contained in:
Emil Lerch 2026-02-05 16:02:45 -08:00
parent bbb65e08b9
commit 0b8ec4aa89
Signed by: lobo
GPG key ID: A7B62D657EF764F8

View file

@ -350,7 +350,7 @@ pub const FormatOptions = struct {
long_format: bool = false, long_format: bool = false,
/// Will emit the eof directive as well as requireeof /// Will emit the eof directive as well as requireeof
emit_eof: bool = true, emit_eof: bool = false,
}; };
/// Returns a formatter that formats the given value /// Returns a formatter that formats the given value
@ -778,6 +778,28 @@ test "format all the things" {
} }, } },
}; };
var buf: [1024]u8 = undefined; var buf: [1024]u8 = undefined;
const formatted_eof = try std.fmt.bufPrint(
&buf,
"{f}",
.{fmt(records, .{ .long_format = true, .emit_eof = true })},
);
try std.testing.expectEqualStrings(
\\#!srfv1
\\#!long
\\#!requireeof
\\foo::bar
\\foo:null:
\\foo:binary:YmFy
\\foo:num:42
\\
\\foo::bar
\\foo:null:
\\foo:binary:YmFy
\\foo:num:42
\\#!eof
\\
, formatted_eof);
const formatted = try std.fmt.bufPrint( const formatted = try std.fmt.bufPrint(
&buf, &buf,
"{f}", "{f}",