Skip to content

Commit

Permalink
Update test to match original issue
Browse files Browse the repository at this point in the history
  • Loading branch information
nojaf committed Apr 23, 2024
1 parent b48ccb7 commit 735b6ca
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 36 deletions.
50 changes: 15 additions & 35 deletions src/Fantomas.Core.Tests/ErianTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -8,50 +8,31 @@ open Fantomas.Core.Tests.TestHelpers
let config =
{ config with
ExperimentalErian = true
MultilineBracketStyle = Aligned }
MultilineBracketStyle = Stroustrup }

[<Test>]
let ``testing the waters`` () =
formatSourceString
"""
type R =
{
Xemnas: int
Xigbar: int
Xaldin: int
Vexen: int
Lexaeus: int
Zexion: int
Saïx: int
Axel: int
Demyx: int
Luxord: int
Marluxia: int
Larxene: int
Roxas: int
}
type Person =
{ id : ID
name : string
age : int
nationality : Nation option
likesPho : bool }
"""
config
|> prepend newline
|> should
equal
"""
type R =
{
Xemnas: int
Xigbar: int
Xaldin: int
Vexen: int
Lexaeus: int
Zexion: int
Saïx: int
Axel: int
Demyx: int
Luxord: int
Marluxia: int
Larxene: int
Roxas: int
}
type Person = {
id : ID
name : string
age : int
nationality : Nation option
likesPho : bool
}
"""

[<Test>]
Expand All @@ -65,8 +46,7 @@ let rei =
nationality = Some(Nations.Japan)
likesPho = true }
"""
{ config with
MultilineBracketStyle = Stroustrup }
config
|> prepend newline
|> should
equal
Expand Down
4 changes: 3 additions & 1 deletion src/Fantomas.Core/CodePrinter.fs
Original file line number Diff line number Diff line change
Expand Up @@ -3702,8 +3702,10 @@ let genFieldAux (longestFieldName: int) (node: FieldNode) =
| None -> genType node.Type
| Some name ->
genSingleTextNode name
+> onlyIfCtx
(fun ctx -> ctx.Config.ExperimentalErian)
(rep (longestFieldName - name.Text.Length + 1) (!- " "))
+> sepColon
+> rep (longestFieldName - name.Text.Length) (!- " ")
+> autoIndentAndNlnTypeUnlessStroustrup genType node.Type)

genXml node.XmlDoc
Expand Down

0 comments on commit 735b6ca

Please sign in to comment.