Skip to content

Commit 19c88db

Browse files
Viridovicsnojaf
andauthored
Delete spaces for named arguments (#2038)
* delete spaces for named arguments * restore space for multiline function argument * delete spaces for PatWithIdent * fix build * restore spaces * revert changes for CodePrinter.fs Co-authored-by: Florian Verdonck <[email protected]>
1 parent 6e88224 commit 19c88db

File tree

2 files changed

+48
-0
lines changed

2 files changed

+48
-0
lines changed

src/Fantomas.Tests/AppTests.fs

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -751,3 +751,31 @@ x |> f<y> // some comment
751751
"""
752752
x |> f<y> // some comment
753753
"""
754+
755+
[<Test>]
756+
let ``single named arguments should have space surrounding the '=', 1877`` () =
757+
formatSourceString
758+
false
759+
"""
760+
let makeStreamReader x = new System.IO.StreamReader(path=x)"""
761+
config
762+
|> prepend newline
763+
|> should
764+
equal
765+
"""
766+
let makeStreamReader x = new System.IO.StreamReader(path = x)
767+
"""
768+
769+
[<Test>]
770+
let ``multiple named arguments should have space surrounding the '=', 1877`` () =
771+
formatSourceString
772+
false
773+
"""
774+
let makeStreamReader x y = new StreamReader(arg1=x, arg2=y)"""
775+
config
776+
|> prepend newline
777+
|> should
778+
equal
779+
"""
780+
let makeStreamReader x y = new StreamReader(arg1 = x, arg2 = y)
781+
"""

src/Fantomas.Tests/PatternMatchingTests.fs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2047,3 +2047,23 @@ match!
20472047
| None -> false
20482048
| Some balance -> someRetrievedBalance = balance
20492049
"""
2050+
2051+
[<Test>]
2052+
let ``single line named fields in a pattern matching should have space surrounding the '=', 1877`` () =
2053+
formatSourceString
2054+
false
2055+
"""
2056+
let examineData x =
2057+
match data with
2058+
| OnePartData(part1 = p1) -> p1
2059+
| TwoPartData(part1 = p1; part2=p2) -> p1 + p2"""
2060+
config
2061+
|> prepend newline
2062+
|> should
2063+
equal
2064+
"""
2065+
let examineData x =
2066+
match data with
2067+
| OnePartData (part1 = p1) -> p1
2068+
| TwoPartData (part1 = p1; part2 = p2) -> p1 + p2
2069+
"""

0 commit comments

Comments
 (0)