Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add regression test for 2110 #2564

Merged
merged 1 commit into from
Oct 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog

## [Unreleased]

### Fixed
* Overly aggressive de-indentation. [#2110](https://github.com/fsprojects/fantomas/issues/2110)

## [5.0.5] - 2022-10-07

### Fixed
Expand Down
44 changes: 44 additions & 0 deletions src/Fantomas.Core.Tests/QuotationTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -132,3 +132,47 @@ test
.Trim([| '\u00FF' |])
@>
"""

[<Test>]
let ``overly aggressive de-indentation, 2110`` () =
formatSourceString
false
"""
let result =
Instrument.I.instrumentationVisitor state' visited

test
<@ { result with
RecordingMethodRef =
{ Visit = null
Push = null
Pop = null } } = { state' with
ModuleId = def.MainModule.Mvid.ToString()
RecordingMethod = visit
RecordingMethodRef =
{ Visit = null
Push = null
Pop = null } } @>
"""
{ config with IndentSize = 2 }
|> prepend newline
|> should
equal
"""
let result = Instrument.I.instrumentationVisitor state' visited

test
<@
{ result with
RecordingMethodRef =
{ Visit = null
Push = null
Pop = null } } = { state' with
ModuleId = def.MainModule.Mvid.ToString()
RecordingMethod = visit
RecordingMethodRef =
{ Visit = null
Push = null
Pop = null } }
@>
"""