Skip to content

Commit

Permalink
Trim spaces
Browse files Browse the repository at this point in the history
Signed-off-by: Etienne Millon <me@emillon.org>
  • Loading branch information
emillon committed Jan 18, 2019
1 parent fd8face commit 5cd6fab
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/dune_fmt.ml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ let print_wrapped_list fmt =
)

let pp_comment_line fmt l =
Format.fprintf fmt "; %s" l
Format.fprintf fmt "; %s" (String.trim l)

let pp_comment loc fmt (comment:Dune_lang.Cst.Comment.t) =
match comment with
Expand Down
24 changes: 19 additions & 5 deletions test/blackbox-tests/test-cases/fmt/run.t
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ Comments are preserved.
> g
> )
> EOF
; comment
; comment
(; first comment
a
Expand All @@ -126,11 +126,11 @@ Comments are preserved.
; comment for ccc
d
e
; unattached comment
; unattached comment
f
; unattached
; multi-line
; comment
; unattached
; multi-line
; comment
g)
When a comment is at the end of a list, the ")" is on a own line.
Expand All @@ -150,3 +150,17 @@ When a comment is at the end of a list, the ")" is on a own line.
; multiline
; comment
)
Spaces are trimmed.
$ dune unstable-fmt <<EOF
> (a
> b;no space
> ; too many spaces
> )
> EOF
(a
b
; no space
; too many spaces
)

0 comments on commit 5cd6fab

Please sign in to comment.