diff --git a/src/Fantomas.Tests/AppTests.fs b/src/Fantomas.Tests/AppTests.fs index f2c4c5c95d..6adb60fad5 100644 --- a/src/Fantomas.Tests/AppTests.fs +++ b/src/Fantomas.Tests/AppTests.fs @@ -751,3 +751,31 @@ x |> f // some comment """ x |> f // some comment """ + +[] +let ``single named arguments should have space surrounding the '=', 1877`` () = + formatSourceString + false + """ +let makeStreamReader x = new System.IO.StreamReader(path=x)""" + config + |> prepend newline + |> should + equal + """ +let makeStreamReader x = new System.IO.StreamReader(path = x) +""" + +[] +let ``multiple named arguments should have space surrounding the '=', 1877`` () = + formatSourceString + false + """ +let makeStreamReader x y = new StreamReader(arg1=x, arg2=y)""" + config + |> prepend newline + |> should + equal + """ +let makeStreamReader x y = new StreamReader(arg1 = x, arg2 = y) +""" diff --git a/src/Fantomas.Tests/PatternMatchingTests.fs b/src/Fantomas.Tests/PatternMatchingTests.fs index 002f691f87..91ec1d32dd 100644 --- a/src/Fantomas.Tests/PatternMatchingTests.fs +++ b/src/Fantomas.Tests/PatternMatchingTests.fs @@ -2047,3 +2047,23 @@ match! | None -> false | Some balance -> someRetrievedBalance = balance """ + +[] +let ``single line named fields in a pattern matching should have space surrounding the '=', 1877`` () = + formatSourceString + false + """ +let examineData x = + match data with + | OnePartData(part1 = p1) -> p1 + | TwoPartData(part1 = p1; part2=p2) -> p1 + p2""" + config + |> prepend newline + |> should + equal + """ +let examineData x = + match data with + | OnePartData (part1 = p1) -> p1 + | TwoPartData (part1 = p1; part2 = p2) -> p1 + p2 +"""