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.
Added support for SynExpr.Set, fsprojects#368
- Loading branch information
Showing
5 changed files
with
57 additions
and
3 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,46 @@ | ||
module Fantomas.Tests.SynExprSetTests | ||
|
||
open NUnit.Framework | ||
open FsUnit | ||
open Fantomas.Tests.TestHelper | ||
|
||
/// See https://github.com/fsharp/fsharp/blob/master/src/fsharp/ast.fs#L633 | ||
/// F# syntax: expr <- expr | ||
/// | Set of SynExpr * SynExpr * range:range | ||
[<Test>] | ||
let ``array indexer set`` () = | ||
formatSourceString false """ | ||
let arr = [|0|] | ||
(arr.[0]) <- 1 | ||
""" config | ||
|> should equal """let arr = [| 0 |] | ||
(arr.[0]) <- 1 | ||
""" | ||
|
||
[<Test>] | ||
let ``setter of type set`` () = | ||
formatSourceString false """ | ||
type T() = | ||
member val X = 0 with get, set | ||
(T().X) <- 1 | ||
""" config | ||
|> prepend newline | ||
|> should equal """ | ||
type T() = | ||
member val X = 0 with get, set | ||
(T().X) <- 1 | ||
""" | ||
|
||
[<Test>] | ||
let ``mutable value set`` () = | ||
formatSourceString false """ | ||
let mutable x = 0 | ||
(x) <- 1 | ||
""" config | ||
|> should equal """let mutable x = 0 | ||
(x) <- 1 | ||
""" |
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