forked from fsprojects/fantomas
-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Extract keyword for SingleExpr expressions. (fsprojects#2045)
Fixes fsprojects#1875.
- Loading branch information
Showing
8 changed files
with
374 additions
and
80 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,215 @@ | ||
module Fantomas.Tests.SingleExprTests | ||
|
||
open NUnit.Framework | ||
open FsUnit | ||
open Fantomas.Tests.TestHelper | ||
|
||
[<Test>] | ||
let ``comment after do keyword, 1875`` () = | ||
formatSourceString | ||
false | ||
""" | ||
do // Comment DO | ||
let x = 1 | ||
f (x) | ||
""" | ||
config | ||
|> prepend newline | ||
|> should | ||
equal | ||
""" | ||
do // Comment DO | ||
let x = 1 | ||
f (x) | ||
""" | ||
|
||
[<Test>] | ||
let ``comment after do bang keyword`` () = | ||
formatSourceString | ||
false | ||
""" | ||
async { | ||
do! // Comment DO BANG | ||
let x = 1 | ||
f (x) } | ||
""" | ||
config | ||
|> prepend newline | ||
|> should | ||
equal | ||
""" | ||
async { | ||
do! // Comment DO BANG | ||
let x = 1 | ||
f (x) | ||
} | ||
""" | ||
|
||
[<Test>] | ||
let ``comment after return bang keyword`` () = | ||
formatSourceString | ||
false | ||
""" | ||
async { | ||
return! // Comment RETURN BANG | ||
foobar() | ||
} | ||
""" | ||
config | ||
|> prepend newline | ||
|> should | ||
equal | ||
""" | ||
async { | ||
return! // Comment RETURN BANG | ||
foobar () | ||
} | ||
""" | ||
|
||
[<Test>] | ||
let ``comment after yield bang keyword`` () = | ||
formatSourceString | ||
false | ||
""" | ||
seq { | ||
yield! // Comment YIELD BANG | ||
foobar() | ||
} | ||
""" | ||
config | ||
|> prepend newline | ||
|> should | ||
equal | ||
""" | ||
seq { | ||
yield! // Comment YIELD BANG | ||
foobar () | ||
} | ||
""" | ||
|
||
[<Test>] | ||
let ``comment after return keyword`` () = | ||
formatSourceString | ||
false | ||
""" | ||
async { | ||
return // Comment RETURN | ||
foobar() | ||
} | ||
""" | ||
config | ||
|> prepend newline | ||
|> should | ||
equal | ||
""" | ||
async { | ||
return // Comment RETURN | ||
foobar () | ||
} | ||
""" | ||
|
||
[<Test>] | ||
let ``comment after yield keyword`` () = | ||
formatSourceString | ||
false | ||
""" | ||
seq { | ||
yield // Comment YIELD | ||
foobar() | ||
} | ||
""" | ||
config | ||
|> prepend newline | ||
|> should | ||
equal | ||
""" | ||
seq { | ||
yield // Comment YIELD | ||
foobar () | ||
} | ||
""" | ||
|
||
[<Test>] | ||
let ``comment after assert keyword`` () = | ||
formatSourceString | ||
false | ||
""" | ||
assert // comment | ||
foobar | ||
""" | ||
config | ||
|> prepend newline | ||
|> should | ||
equal | ||
""" | ||
assert // comment | ||
foobar | ||
""" | ||
|
||
[<Test>] | ||
let ``comment after downcast keyword`` () = | ||
formatSourceString | ||
false | ||
""" | ||
downcast // comment | ||
foobar | ||
""" | ||
config | ||
|> prepend newline | ||
|> should | ||
equal | ||
""" | ||
downcast // comment | ||
foobar | ||
""" | ||
|
||
[<Test>] | ||
let ``comment after upcast keyword`` () = | ||
formatSourceString | ||
false | ||
""" | ||
upcast // comment | ||
foobar | ||
""" | ||
config | ||
|> prepend newline | ||
|> should | ||
equal | ||
""" | ||
upcast // comment | ||
foobar | ||
""" | ||
|
||
[<Test>] | ||
let ``comment after address of token`` () = | ||
formatSourceString | ||
false | ||
""" | ||
& // comment | ||
foobar | ||
""" | ||
config | ||
|> prepend newline | ||
|> should | ||
equal | ||
""" | ||
& // comment | ||
foobar | ||
""" | ||
|
||
[<Test>] | ||
let ``comment after address of tokens`` () = | ||
formatSourceString | ||
false | ||
""" | ||
&& // comment | ||
foobar | ||
""" | ||
config | ||
|> prepend newline | ||
|> should | ||
equal | ||
""" | ||
&& // comment | ||
foobar | ||
""" |
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
Oops, something went wrong.