Add doc_comments to param decl

This commit is contained in:
Shritesh Bhattarai
2019-03-27 10:58:25 -05:00
parent 85575704a4
commit efa751c339
4 changed files with 26 additions and 1 deletions

View File

@@ -75,6 +75,26 @@ test "zig fmt: correctly move doc comments on struct fields" {
);
}
test "zig fmt: doc comments on param decl" {
try testCanonical(
\\pub const Allocator = struct {
\\ shrinkFn: fn (
\\ self: *Allocator,
\\ /// Guaranteed to be the same as what was returned from most recent call to
\\ /// `allocFn`, `reallocFn`, or `shrinkFn`.
\\ old_mem: []u8,
\\ /// Guaranteed to be the same as what was returned from most recent call to
\\ /// `allocFn`, `reallocFn`, or `shrinkFn`.
\\ old_alignment: u29,
\\ /// Guaranteed to be less than or equal to `old_mem.len`.
\\ new_byte_count: usize,
\\ /// Guaranteed to be less than or equal to `old_alignment`.
\\ new_alignment: u29,
\\ ) []u8,
\\};
);
}
test "zig fmt: preserve space between async fn definitions" {
try testCanonical(
\\async fn a() void {}