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

Added regression test for #264. #355

Merged
merged 1 commit into from
Nov 16, 2018
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
Binary file modified .paket/paket.exe
Binary file not shown.
22 changes: 22 additions & 0 deletions src/Fantomas.Tests/ModuleTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -307,4 +307,26 @@ module private rec Test =
|> should equal """
module private rec Test =
let test = 42
"""

[<Test>]
let ``Implicit module should not be added to code`` () =
let fileName = "Program.fs"
let sourceCode = """open System

type T() =
interface IDisposable with
override x.Dispose() = ()"""

// IsExe would introduce an implicit module, it should not be added after formatting.
let parsingOptions = { parsingOptions fileName with IsExe = true }

Fantomas.CodeFormatter.FormatDocumentAsync(fileName, sourceCode, config, parsingOptions, sharedChecker.Value)
|> Async.RunSynchronously
|> fun s -> s.Replace("\r\n", "\n")
|> should equal """open System

type T() =
interface IDisposable with
override x.Dispose() = ()
"""