Skip to content

Commit

Permalink
Add tests to validate code has been fixed (#2715)
Browse files Browse the repository at this point in the history
Co-authored-by: Florian Verdonck <[email protected]>
  • Loading branch information
josh-degraw and nojaf authored Jan 14, 2023
1 parent 0d0cab0 commit b5129e4
Showing 1 changed file with 58 additions and 0 deletions.
58 changes: 58 additions & 0 deletions src/Fantomas.Core.Tests/TypeDeclarationTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -711,6 +711,64 @@ type Delegate4 = delegate of int -> int -> int
type U = U of (int * int)
"""

[<Test>]
let ``very long delegate type alias, 1514`` () =
formatSourceString
false
"""
type SomeWin32Callback = delegate of NastyWinApi32Type * int * int * int * NastyWinApi32Type * int * int * int * int * NastyWinApi32Type * int * int -> bool
"""
{ config with MaxLineLength = 60 }
|> prepend newline
|> should
equal
"""
type SomeWin32Callback =
delegate of
NastyWinApi32Type *
int *
int *
int *
NastyWinApi32Type *
int *
int *
int *
int *
NastyWinApi32Type *
int *
int ->
bool
"""

[<Test>]
let ``very long delegate type alias wrapped in parens, 1514`` () =
formatSourceString
false
"""
type SomeWin32Callback = delegate of (NastyWinApi32Type * int * int * int * NastyWinApi32Type * int * int * int * int * NastyWinApi32Type * int * int) -> bool
"""
{ config with MaxLineLength = 60 }
|> prepend newline
|> should
equal
"""
type SomeWin32Callback =
delegate of
(NastyWinApi32Type *
int *
int *
int *
NastyWinApi32Type *
int *
int *
int *
int *
NastyWinApi32Type *
int *
int) ->
bool
"""

[<Test>]
let ``should keep the ? in optional parameters`` () =
formatSourceString
Expand Down

0 comments on commit b5129e4

Please sign in to comment.