fix tests
This commit is contained in:
parent
bbb65e08b9
commit
0b8ec4aa89
1 changed files with 26 additions and 4 deletions
24
src/srf.zig
24
src/srf.zig
|
|
@ -350,7 +350,7 @@ pub const FormatOptions = struct {
|
|||
long_format: bool = false,
|
||||
|
||||
/// 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
|
||||
|
|
@ -778,6 +778,28 @@ test "format all the things" {
|
|||
} },
|
||||
};
|
||||
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(
|
||||
&buf,
|
||||
"{f}",
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue