From 622e2b0c6d9d6663034af781c4259b2d2f0a0f42 Mon Sep 17 00:00:00 2001 From: Florian Verdonck Date: Fri, 15 May 2020 09:50:27 +0200 Subject: [PATCH] Adding regression test for #516. (#828) --- src/Fantomas.Tests/CommentTests.fs | 32 ++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/src/Fantomas.Tests/CommentTests.fs b/src/Fantomas.Tests/CommentTests.fs index 3bc8f9eb1f..adacd1f38c 100644 --- a/src/Fantomas.Tests/CommentTests.fs +++ b/src/Fantomas.Tests/CommentTests.fs @@ -399,6 +399,38 @@ printfn "hello world" (* This is a comment. *) """ +[] +let ``preserve block comment after record, 516`` () = + formatSourceString false """module TriviaModule = + +let env = "DEBUG" + +type Config = { + Name: string + Level: int +} + +let meh = { // this comment right + Name = "FOO"; Level = 78 } + +(* ending with block comment *) +""" config + |> prepend newline + |> should equal """ +module TriviaModule = + + let env = "DEBUG" + + type Config = { Name: string; Level: int } + + let meh = + { // this comment right + Name = "FOO" + Level = 78 } + +(* ending with block comment *) +""" + [] let ``should keep comments inside unit``() = formatSourceString false """