Skip to content

Commit

Permalink
Removed trailing spaces for each line, after formatting. Should fix f…
Browse files Browse the repository at this point in the history
  • Loading branch information
nojaf committed Oct 21, 2018
1 parent 124c35d commit 38d5587
Show file tree
Hide file tree
Showing 25 changed files with 141 additions and 113 deletions.
2 changes: 1 addition & 1 deletion src/Fantomas.Tests/ActivePatternTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ let (|Integer|_|) (str : string) =
let (|ParseRegex|_|) regex str =
let m = Regex(regex).Match(str)
if m.Success then
if m.Success then
Some(List.tail [ for x in m.Groups -> x.Value ])
else None
"""
20 changes: 10 additions & 10 deletions src/Fantomas.Tests/ClassTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -100,23 +100,23 @@ type Shape2D(x0 : float, y0 : float) =
type Shape2D(x0 : float, y0 : float) =
let mutable x, y = x0, y0
let mutable rotAngle = 0.0
member this.CenterX
with get () = x
and set xval = x <- xval
member this.CenterY
with get () = y
and set yval = y <- yval
abstract Area : float
abstract Perimeter : float
abstract Name : string
member this.Move dx dy =
x <- x + dx
y <- y + dy
abstract Rotate : float -> unit
override this.Rotate(angle) = rotAngle <- rotAngle + angle
"""
Expand Down Expand Up @@ -221,13 +221,13 @@ type MyClassDerived2(y: int) =
|> should equal """
type MyClassBase2(x : int) =
let mutable z = x * x
do
do
for i in 1..z do
printf "%d " i
type MyClassDerived2(y : int) =
inherit MyClassBase2(y * 2)
do
do
for i in 1..y do
printf "%d " i
"""
Expand Down Expand Up @@ -291,7 +291,7 @@ let ``member properties with type annotation``() =
""" config
|> should equal """type A() =
member this.X : int = 1
member this.Y
with get () : int = 1
and set (_ : int) : unit = ()
Expand Down Expand Up @@ -343,8 +343,8 @@ let longNamedClasslongNamedClasslongNamedClasslongNamedClasslongNamedClasslongNa
T()
System.String.Concat
("a",
"b"
("a",
"b"
+ (longNamedFunlongNamedFunlongNamedFunlongNamedFunlongNamedFun
(longNamedClasslongNamedClasslongNamedClasslongNamedClasslongNamedClasslongNamedClass)).Property)
"""
Expand Down
10 changes: 5 additions & 5 deletions src/Fantomas.Tests/CommentTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ let print_30_permut() =
let print_30_permut() =
/// declare and initialize
let permutation : int array =
Array.init n (fun i ->
Array.init n (fun i ->
Console.Write(i + 1)
i)
permutation
Expand All @@ -61,7 +61,7 @@ let print_30_permut() =
let print_30_permut() =
/// declare and initialize
let permutation : int array =
Array.init n (fun (i, j) ->
Array.init n (fun (i, j) ->
Console.Write(i + 1)
i)
permutation
Expand Down Expand Up @@ -207,8 +207,8 @@ type IlxGenIntraAssemblyInfo =
|> should equal """
/// Non-local information related to internals of code generation within an assembly
type IlxGenIntraAssemblyInfo =
{ /// A table recording the generated name of the static backing fields for each mutable top level value where
/// we may need to take the address of that value, e.g. static mutable module-bound values which are structs. These are
{ /// A table recording the generated name of the static backing fields for each mutable top level value where
/// we may need to take the address of that value, e.g. static mutable module-bound values which are structs. These are
/// only accessible intra-assembly. Across assemblies, taking the address of static mutable module-bound values is not permitted.
/// The key to the table is the method ref for the property getter for the value, which is a stable name for the Val's
/// that come from both the signature and the implementation.
Expand Down Expand Up @@ -279,7 +279,7 @@ type IlxGenOptions =
generateFilterBlocks : bool;
workAroundReflectionEmitBugs : bool;
emitConstantArraysUsingStaticDataBlobs : bool;
// If this is set, then the last module becomes the "main" module and its toplevel bindings are executed at startup
// If this is set, then the last module becomes the "main" module and its toplevel bindings are executed at startup
mainMethodInfo : Tast.Attribs option;
localOptimizationsAreOn : bool;
generateDebugSymbols : bool;
Expand Down
4 changes: 2 additions & 2 deletions src/Fantomas.Tests/ComparisonTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ let ``should keep the = on the same line in record def``() =
let doRead (reader : JsonReader) = reader.Read() |> ignore
override x.CanConvert(typ : Type) =
let result =
((typ.GetInterface(typeof<System.Collections.IEnumerable>.FullName) = null)
((typ.GetInterface(typeof<System.Collections.IEnumerable>.FullName) = null)
&& FSharpType.IsUnion typ)
result
"""
Expand All @@ -35,6 +35,6 @@ let ``should keep the = on the same line in record def``() =
let ``should keep the = on the same line``() =
formatSourceString false """trimSpecialChars(controller.ServerName.ToUpper()) = trimSpecialChars(serverFilter.ToUpper())
""" config
|> should equal """trimSpecialChars (controller.ServerName.ToUpper()) = trimSpecialChars
|> should equal """trimSpecialChars (controller.ServerName.ToUpper()) = trimSpecialChars
(serverFilter.ToUpper())
"""
2 changes: 1 addition & 1 deletion src/Fantomas.Tests/CompilerDirectivesTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ namespace Internal.Utilities.Diagnostic
#if EXTENSIBLE_DUMPER
#if DEBUG
type ExtensibleDumper = A | B
#endif
#endif
#endif
Expand Down
14 changes: 7 additions & 7 deletions src/Fantomas.Tests/ComputationExpressionTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ let fetchAsync(name, url:string) =
|> prepend newline
|> should equal """
let fetchAsync (name, url : string) =
async {
try
async {
try
let uri = new System.Uri(url)
let webClient = new WebClient()
let! html = webClient.AsyncDownloadString(uri)
Expand All @@ -46,7 +46,7 @@ let comp =
|> prepend newline
|> should equal """
let comp =
eventually {
eventually {
for x in 1..2 do
printfn " x = %d" x
return 3 + 4
Expand All @@ -71,16 +71,16 @@ let rec inorder tree =
|> prepend newline
|> should equal """
let s1 =
seq {
seq {
for i in 1..10 -> i * i
}
let s2 = seq { 0..10..100 }
let rec inorder tree =
seq {
seq {
match tree with
| Tree(x, left, right) ->
| Tree(x, left, right) ->
yield! inorder left
yield x
yield! inorder right
Expand Down Expand Up @@ -110,7 +110,7 @@ async {
}""" config
|> prepend newline
|> should equal """
async {
async {
match! myAsyncFunction() with
| Some x -> printfn "%A" x
| None -> printfn "Function returned None!"
Expand Down
18 changes: 9 additions & 9 deletions src/Fantomas.Tests/ControlStructureTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ then printfn "You are only %d years old and already learning F#? Wow!" age""" co
|> should equal """
let rec tryFindMatch pred list =
match list with
| head :: tail ->
| head :: tail ->
if pred (head) then Some(head)
else tryFindMatch pred tail
| [] -> None
Expand All @@ -39,7 +39,7 @@ let test x y =
else if x > y then "is greater than"
else "Don't know"
if age < 10 then
if age < 10 then
printfn "You are only %d years old and already learning F#? Wow!" age
"""

Expand Down Expand Up @@ -92,7 +92,7 @@ let lookForValue value maxValue =
while continueLooping do
let rand = randomNumberGenerator.Next(maxValue)
printf "%d " rand
if rand = value then
if rand = value then
printfn "\nFound a %d!" value
continueLooping <- false
Expand All @@ -113,9 +113,9 @@ let result1 = divide1 100 0
|> prepend newline
|> should equal """
let divide1 x y =
try
try
Some(x / y)
with :? System.DivideByZeroException ->
with :? System.DivideByZeroException ->
printfn "Division by zero!"
None
Expand All @@ -139,8 +139,8 @@ let ``try/with and finally``() =
|> prepend newline
|> should equal """
let function1 x y =
try
try
try
try
if x = y then raise (InnerError("inner"))
else raise (OuterError("outer"))
with
Expand Down Expand Up @@ -223,7 +223,7 @@ let x =
|> prepend newline
|> should equal """
let x =
if try
if try
true
with Failure _ -> false
then ()
Expand Down Expand Up @@ -255,7 +255,7 @@ let handle =
|> prepend newline
|> should equal """
let handle =
if n < weakThreshhold then
if n < weakThreshhold then
assert onStrongDiscard.IsNone // it disappeared
Weak(WeakReference(v))
else Strong(v)
Expand Down
8 changes: 4 additions & 4 deletions src/Fantomas.Tests/DataStructureTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ let listLength list =
|> should equal """
let rec printList l =
match l with
| head :: tail ->
| head :: tail ->
printf "%d " head
printList tail
| [] -> printfn ""
Expand Down Expand Up @@ -94,8 +94,8 @@ let vectorLength vec =
| [| var1 |] -> var1
| [| var1; var2 |] -> sqrt (var1 * var1 + var2 * var2)
| [| var1; var2; var3 |] -> sqrt (var1 * var1 + var2 * var2 + var3 * var3)
| _ ->
failwith "vectorLength called with an unsupported array size of %d."
| _ ->
failwith "vectorLength called with an unsupported array size of %d."
(vec.Length)
"""

Expand All @@ -109,7 +109,7 @@ let ``should keep -> notation``() =
|> prepend newline
|> should equal """
let environVars target =
[ for e in Environment.GetEnvironmentVariables target ->
[ for e in Environment.GetEnvironmentVariables target ->
let e1 = e :?> Collections.DictionaryEntry
e1.Key, e1.Value ]
"""
Expand Down
1 change: 1 addition & 0 deletions src/Fantomas.Tests/Fantomas.Tests.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
<Compile Include="FormattingPropertyTests.fs" />
<Compile Include="SpecialConstructsTests.fs" />
<Compile Include="FormatAstTests.fs" />
<Compile Include="NoTrailingSpacesTests.fs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Fantomas\Fantomas.fsproj" />
Expand Down
2 changes: 1 addition & 1 deletion src/Fantomas.Tests/FormattingSelectionOnlyTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ let rangeTest testValue mid size =
let (var1, var2) as tuple1 = (1, 2)""" config
|> append newline
|> should equal """match testValue with
| var1 when var1 >= mid - size / 2 && var1 <= mid + size / 2 ->
| var1 when var1 >= mid - size / 2 && var1 <= mid + size / 2 ->
printfn "The test value is in range."
| _ -> printfn "The test value is out of range."
"""
Expand Down
4 changes: 2 additions & 2 deletions src/Fantomas.Tests/FormattingSelectionTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ let (var1, var2) as tuple1 = (1, 2)""" config
|> should equal """
let rangeTest testValue mid size =
match testValue with
| var1 when var1 >= mid - size / 2 && var1 <= mid + size / 2 ->
| var1 when var1 >= mid - size / 2 && var1 <= mid + size / 2 ->
printfn "The test value is in range."
| _ -> printfn "The test value is out of range."
Expand Down Expand Up @@ -246,7 +246,7 @@ let comp =
return 3 + 4 }""" config
|> should equal """
let comp =
eventually {
eventually {
for x in 1..2 do
printfn " x = %d" x
return 3 + 4
Expand Down
20 changes: 10 additions & 10 deletions src/Fantomas.Tests/FunctionDefinitionTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ type C () =
|> prepend newline
|> should equal """
type C() =
let rec g x = h x
and h x = g x
member x.P = g 3
"""

Expand Down Expand Up @@ -101,7 +101,7 @@ let ``let bindings with return types``() =
let divide x y =
let stream : System.IO.FileStream = System.IO.File.Create("test.txt")
let writer : System.IO.StreamWriter = new System.IO.StreamWriter(stream)
try
try
writer.WriteLine("test1")
Some(x / y)
finally
Expand Down Expand Up @@ -129,10 +129,10 @@ let inline heterogenousAdd(value1 : ^T when (^T or ^U) : (static member (+) : ^T
value1 + value2""" config
|> prepend newline
|> should equal """
let inline add (value1 : ^T when ^T : (static member (+) : ^T * ^T -> ^T),
let inline add (value1 : ^T when ^T : (static member (+) : ^T * ^T -> ^T),
value2 : ^T) = value1 + value2
let inline heterogenousAdd (value1 : ^T when (^T or ^U) : (static member (+) : ^T * ^U
-> ^T),
-> ^T),
value2 : ^U) = value1 + value2
"""

Expand Down Expand Up @@ -163,11 +163,11 @@ let ``should add spaces between multiline nested let bindings``() =
let f2 x =
let _ = ()
x + 1
let f3 y =
let _ = ()
y + 1
x + y
"""

Expand All @@ -178,7 +178,7 @@ let ``should indent fun blocks``() =
let y = 1
x""" config
|> should equal """let f =
fun x ->
fun x ->
let y = 1
x
"""
Expand Down Expand Up @@ -255,7 +255,7 @@ open System.Runtime.InteropServices
open Accessibility
[<DllImport("oleacc.dll")>]
extern int AccessibleChildren(IAccessible paccContainer, int iChildStart, int cChildren, [<Out; MarshalAs(UnmanagedType.LPArray,
extern int AccessibleChildren(IAccessible paccContainer, int iChildStart, int cChildren, [<Out; MarshalAs(UnmanagedType.LPArray,
SizeParamIndex = 4s)>] System.Object [] rgvarChildren, int* pcObtained)
"""

Expand All @@ -270,7 +270,7 @@ let f = fun x -> match x with X (x) -> x
type U = X of int
let f =
fun x ->
fun x ->
match x with
| X(x) -> x
"""
Expand Down
Loading

0 comments on commit 38d5587

Please sign in to comment.