Skip to content

Commit

Permalink
fsprojects#1238 Unit Tests to test MultilineBlockBracketsOnSameColumn…
Browse files Browse the repository at this point in the history
… = true are changed
  • Loading branch information
humberto-javier.cortes-benavides committed Jan 20, 2021
1 parent fde915b commit 681d0df
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 38 deletions.
34 changes: 1 addition & 33 deletions src/Fantomas.Tests/ControlStructureTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -835,36 +835,4 @@ try
with ex ->
Infrastructure.ReportWarning ex
return None
"""

[<Test>]
let ``MultilineBlockBracketsOnSameColumn should be honored inside match block, 1238`` () =
formatSourceString
false
"""
module Foo =
let Bar () =
if x then
match foo with
| { Bar = true
Baz = _ } -> failwith "xxx"
| _ -> None
"""
{ config with
MaxLineLength = 30
MultilineBlockBracketsOnSameColumn = true }
|> prepend newline
|> should
equal
"""
module Foo =
let Bar () =
if x then
match foo with
| {
Bar = true
Baz = _
}
-> failwith "xxx"
| _ -> None
"""
"""
Original file line number Diff line number Diff line change
Expand Up @@ -560,11 +560,12 @@ let ``SynPat.Record in pattern match with bracketOnSeparateLine`` () =
equal
"""
match foo with
| { Bar = bar
Level = 12
Vibes = plenty
Lorem = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. " } ->
"7"
| {
Bar = bar
Level = 12
Vibes = plenty
Lorem = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. "
} -> "7"
| _ -> "8"
"""

Expand Down Expand Up @@ -955,3 +956,34 @@ type TestType =
// Some more comments
private { Meh : TimeSpan }
"""

[<Test>]
let ``MultilineBlockBracketsOnSameColumn should be honored inside match block, 1238`` () =
formatSourceString
false
"""
module Foo =
let Bar () =
if x then
match foo with
| { Bar = true
Baz = _ } -> failwith "xxx"
| _ -> None
"""
{ config with
MaxLineLength = 30 }
|> prepend newline
|> should
equal
"""
module Foo =
let Bar () =
if x then
match foo with
| {
Bar = true
Baz = _
} ->
failwith "xxx"
| _ -> None
"""

0 comments on commit 681d0df

Please sign in to comment.