-
-
Notifications
You must be signed in to change notification settings - Fork 194
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement MaxBindingWidth for members
Implements the MaxBindingWidth setting for member values and member functions and adds test cases.
- Loading branch information
Showing
6 changed files
with
113 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
module Fantomas.Tests.MaxBindingWidthTests | ||
|
||
open NUnit.Framework | ||
open FsUnit | ||
open Fantomas.Tests.TestHelper | ||
|
||
let config = { config with MaxBindingWidth = 20 } | ||
|
||
[<Test>] | ||
let ``should apply to value definition``() = | ||
formatSourceString false """let a = bbbbbbbbbbbbbbbbbbbbbbbbbb""" config | ||
|> should equal """let a = | ||
bbbbbbbbbbbbbbbbbbbbbbbbbb | ||
""" | ||
|
||
[<Test>] | ||
let ``should not apply to short value definition``() = | ||
formatSourceString false """let a = b""" config | ||
|> should equal """let a = b | ||
""" | ||
|
||
[<Test>] | ||
let ``should apply to function definition``() = | ||
formatSourceString false """let a bbbbbbbbbbbbbbbbbbbbbbbbbb = bbbbbbbbbbbbbbbbbbbbbbbbbb + 1""" config | ||
|> should equal """let a bbbbbbbbbbbbbbbbbbbbbbbbbb = | ||
bbbbbbbbbbbbbbbbbbbbbbbbbb + 1 | ||
""" | ||
|
||
[<Test>] | ||
let ``should not apply to short function definition``() = | ||
formatSourceString false """let a b = b + 1""" config | ||
|> should equal """let a b = b + 1 | ||
""" | ||
|
||
[<Test>] | ||
let ``should apply to member value definition``() = | ||
formatSourceString false """type T = | ||
let aaaaaaaaaaaaaaaaaaaa = bbbbbbbbbbbbbbbbbbb + 1 | ||
member this.ccccccccccccccccccccccccccccccc = dddddddddddddddddddddddddddd + 2 | ||
""" config | ||
|> should equal """type T = | ||
let aaaaaaaaaaaaaaaaaaaa = | ||
bbbbbbbbbbbbbbbbbbb + 1 | ||
member this.ccccccccccccccccccccccccccccccc = | ||
dddddddddddddddddddddddddddd + 2 | ||
""" | ||
|
||
[<Test>] | ||
let ``should not apply to short member value definition``() = | ||
formatSourceString false """type T = | ||
let a = b + 1 | ||
member this.c = d + 2 | ||
""" config | ||
|> should equal """type T = | ||
let a = b + 1 | ||
member this.c = d + 2 | ||
""" | ||
|
||
[<Test>] | ||
let ``should apply to member function definition``() = | ||
formatSourceString false """type T = | ||
let aaaaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbbb = bbbbbbbbbbbbbbbbbbb + 1 | ||
member this.cccccccccccccc dddddddddddddd = dddddddddddddd + 2 | ||
""" config | ||
|> should equal """type T = | ||
let aaaaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbbb = | ||
bbbbbbbbbbbbbbbbbbb + 1 | ||
member this.cccccccccccccc dddddddddddddd = | ||
dddddddddddddd + 2 | ||
""" | ||
|
||
[<Test>] | ||
let ``should not apply to short member function definition``() = | ||
formatSourceString false """type T = | ||
let a b = b + 1 | ||
member this.c d = d + 2 | ||
""" config | ||
|> should equal """type T = | ||
let a b = b + 1 | ||
member this.c d = d + 2 | ||
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters