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 pipe before single case DU with no UnionCaseFields #647

Merged
merged 2 commits into from
Jan 24, 2020
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
35 changes: 35 additions & 0 deletions src/Fantomas.Tests/UnionTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -257,4 +257,39 @@ let ``single case DU with comment above clause, 567`` () =
type 'a MyGenericType =
///
Foo
"""

[<Test>]
let ``single case DU should keep a pipe after formatting, 641`` () =
formatSourceString false """type Record = { Name: string }
type DU = | Record
""" config
|> prepend newline
|> should equal """
type Record =
{ Name: string }

type DU = | Record
"""

[<Test>]
let ``single case DU with fields should not have a pipe after formatting`` () =
formatSourceString false """type DU = Record of string""" config
|> prepend newline
|> should equal """
type DU = Record of string
"""


[<Test>]
let ``single case DU, no UnionCaseFields in signature file`` () =
formatSourceString true """namespace meh

type DU = | Record
""" config
|> prepend newline
|> should equal """
namespace meh

type DU = | Record
"""
Loading