Skip to content

Commit

Permalink
Add regression test for in keyword in SynExpr.LetOrUse. Fixes fsproje…
Browse files Browse the repository at this point in the history
  • Loading branch information
nojaf committed Mar 5, 2022
1 parent 1801b88 commit e381778
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
* 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)
* Comment after match keyword is lost. [#1851](https://github.com/fsprojects/fantomas/issues/1851)
* Preserve in keyword on next line. [#1182](https://github.com/fsprojects/fantomas/issues/1182)

## [4.7.0] - 2022-03-04

Expand Down
39 changes: 39 additions & 0 deletions src/Fantomas.Tests/LetBindingTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -1959,3 +1959,42 @@ let v =
let formatted = formatSourceString false sourceCode config

formatted |> should not' (equal EmptyString)

[<Test>]
let ``in keyword in SynExpr.LetOrUse, 1182`` () =
formatSourceString
false
"""
do
let _ = ()
in
() // note the different indent is allowed here due to `in` use
let escapeEarth myVelocity mySpeed =
let
escapeVelocityInKmPerSec = 11.186
in
if myVelocity > escapeVelocityInKmPerSec then
"Godspeed"
elif mySpeed == orbitalSpeedInKmPerSec then
"Stay in orbit"
else
"Come back"
"""
config
|> prepend newline
|> should
equal
"""
do let _ = () in () // note the different indent is allowed here due to `in` use
let escapeEarth myVelocity mySpeed =
let escapeVelocityInKmPerSec = 11.186 in
if myVelocity > escapeVelocityInKmPerSec then
"Godspeed"
elif mySpeed == orbitalSpeedInKmPerSec then
"Stay in orbit"
else
"Come back"
"""

0 comments on commit e381778

Please sign in to comment.