Skip to content

Commit

Permalink
Add regression tests for lost comments after equals sign. (fsprojects…
Browse files Browse the repository at this point in the history
  • Loading branch information
nojaf authored and jindraivanek committed Mar 30, 2022
1 parent 3b55be3 commit a239de1
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 0 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## [Unreleased]

### Fixed
* Comment after equals is remove in anonymous record. [#1921](https://github.com/fsprojects/fantomas/issues/1921)
* Comment after equals in record type is lost. [#2001](https://github.com/fsprojects/fantomas/issues/2001)

## [4.7.0] - 2022-03-04

### Changed
Expand Down
19 changes: 19 additions & 0 deletions src/Fantomas.Tests/RecordTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -2001,3 +2001,22 @@ type Foo = // comment
type Foo = // comment
{ Bar: int }
"""

[<Test>]
let ``comment after equals sign in anonymous record field, 1921`` () =
formatSourceString
false
"""
let a =
{| Foo = //
2 |}
"""
config
|> prepend newline
|> should
equal
"""
let a =
{| Foo = //
2 |}
"""
21 changes: 21 additions & 0 deletions src/Fantomas.Tests/TypeDeclarationTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -2962,3 +2962,24 @@ type Graph<'a when 'a:comparison> = Set<'a * 'a>
"""
type Graph<'a when 'a: comparison> = Set<'a * 'a>
"""

[<Test>]
let ``comment after equals sign in type defn, 2001`` () =
formatSourceString
false
"""
type V = // comment
{ X: SomeFieldType
Y: OhSomethingElse
Z: ALongTypeName }
"""
config
|> prepend newline
|> should
equal
"""
type V = // comment
{ X: SomeFieldType
Y: OhSomethingElse
Z: ALongTypeName }
"""

0 comments on commit a239de1

Please sign in to comment.