-
-
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.
Change style of base constructor calls. (#2555)
* Change style of base constructor calls. * Add changelog entry for 5.1.0-alpha-005.
- Loading branch information
Showing
7 changed files
with
174 additions
and
58 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
module Fantomas.Core.Tests.BaseConstructorTests | ||
|
||
open NUnit.Framework | ||
open FsUnit | ||
open Fantomas.Core.Tests.TestHelper | ||
|
||
[<Test>] | ||
let ``multiple base constructors in record, 2111`` () = | ||
formatSourceString | ||
false | ||
""" | ||
type UnhandledWebException = | ||
inherit Exception | ||
new(status: WebExceptionStatus, innerException: Exception) = | ||
{ inherit Exception(SPrintF1 | ||
"Backend not prepared for this WebException with Status[%i]" | ||
(int status), | ||
innerException) } | ||
new(info: SerializationInfo, context: StreamingContext) = | ||
{ inherit Exception(info, context) } | ||
""" | ||
{ config with MaxLineLength = 100 } | ||
|> prepend newline | ||
|> should | ||
equal | ||
""" | ||
type UnhandledWebException = | ||
inherit Exception | ||
new(status: WebExceptionStatus, innerException: Exception) = | ||
{ inherit | ||
Exception( | ||
SPrintF1 "Backend not prepared for this WebException with Status[%i]" (int status), | ||
innerException | ||
) } | ||
new(info: SerializationInfo, context: StreamingContext) = { inherit Exception(info, context) } | ||
""" | ||
|
||
[<Test>] | ||
let ``single multiline base constructor, 2335`` () = | ||
formatSourceString | ||
false | ||
""" | ||
type FieldNotFoundException<'T>(obj:'T, field:string, specLink:string) = | ||
inherit SwaggerSchemaParseException( | ||
sprintf "Object MUST contain field `%s` (See %s for more details).\nObject:%A" | ||
field specLink obj) | ||
""" | ||
{ config with | ||
SpaceBeforeClassConstructor = true | ||
MaxLineLength = 90 } | ||
|> prepend newline | ||
|> should | ||
equal | ||
""" | ||
type FieldNotFoundException<'T> (obj: 'T, field: string, specLink: string) = | ||
inherit | ||
SwaggerSchemaParseException ( | ||
sprintf | ||
"Object MUST contain field `%s` (See %s for more details).\nObject:%A" | ||
field | ||
specLink | ||
obj | ||
) | ||
""" |
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
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