Skip to content

Commit

Permalink
tests added
Browse files Browse the repository at this point in the history
  • Loading branch information
DedSec256 committed Sep 12, 2020
1 parent 4f2b4ce commit 927ca40
Show file tree
Hide file tree
Showing 14 changed files with 117 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
let f x y = ()

fun x y ->{caret} f x y
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
let f x y = ()

f{caret}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
let f x y = ()

fun x y ->{caret} f 1 y
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
let f x y = ()

fun x ->{caret} f 1
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
let f x y = ()

fun x ->{caret} f 1 x
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
let f x y = ()

f {caret}1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
fun x ->{caret} x
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
let {caret}foo x = 1
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module Test

let f x y = ()

let _ = fun x y ->{caret} f 1 y
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
module Test

let f |x|(0) |y|(1) = ()

let _ = |fun |x|(3) y -> f 1 y|(2)

------------------------------------------------
0: The value 'x' is unused
QUICKFIXES:
Replace with '_'
--Replace unused values with '_' in binding patterns
--Replace unused values with '_' in file
--Replace unused values with '_' in project
--Replace unused values with '_' in solution
Rename to '_x'
1: The value 'y' is unused
QUICKFIXES:
Replace with '_'
--Replace unused values with '_' in binding patterns
--Replace unused values with '_' in file
--Replace unused values with '_' in project
--Replace unused values with '_' in solution
Rename to '_y'
2: Lambda can be simplified
QUICKFIXES:
Simplify lambda
3: The value 'x' is unused
QUICKFIXES:
Replace with '_'
--Replace unused values with '_' in parameter list
--Replace unused values with '_' in file
--Replace unused values with '_' in project
--Replace unused values with '_' in solution
Rename to '_x'
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module Test

let f x y = ()

let _ = fun x y ->{caret} f x y
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
module Test

let f |x|(0) |y|(1) = ()

let _ = |fun x y -> f x y|(2)

------------------------------------------------
0: The value 'x' is unused
QUICKFIXES:
Replace with '_'
--Replace unused values with '_' in binding patterns
--Replace unused values with '_' in file
--Replace unused values with '_' in project
--Replace unused values with '_' in solution
Rename to '_x'
1: The value 'y' is unused
QUICKFIXES:
Replace with '_'
--Replace unused values with '_' in binding patterns
--Replace unused values with '_' in file
--Replace unused values with '_' in project
--Replace unused values with '_' in solution
Rename to '_y'
2: Lambda can be simplified
QUICKFIXES:
To application
1 change: 1 addition & 0 deletions ReSharper.FSharp/test/src/FSharp.Tests/FSharp.Tests.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@
<Compile Include="QuickFixes\AddParensToApplicationTest.fs" />
<Compile Include="QuickFixes\NamespaceToModuleTest.fs" />
<Compile Include="QuickFixes\SimplifyListConsPatTest.fs" />
<Compile Include="QuickFixes\SimplifyLambdaTest.fs" />
<Compile Include="Intentions\IntentionsTestBase.fs" />
<Compile Include="Intentions\ToRecursiveLetBindings.fs" />
<Compile Include="Intentions\ToMultilineRecordTest.fs" />
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
namespace JetBrains.ReSharper.Plugins.FSharp.Tests.Features

open JetBrains.ReSharper.FeaturesTestFramework.Intentions
open JetBrains.ReSharper.Plugins.FSharp.Psi.Features.Daemon.QuickFixes
open JetBrains.ReSharper.Plugins.FSharp.Tests
open NUnit.Framework

type SimplifyLambdaTest() =
inherit FSharpQuickFixTestBase<SimplifyLambdaFix>()

override x.RelativeTestDataPath = "features/quickFixes/simplifyLambda"

[<Test>] member x.``Application``() = x.DoNamedTest()
[<Test>] member x.``Partial application 1``() = x.DoNamedTest()
[<Test>] member x.``Partial application 2``() = x.DoNamedTest()
[<Test; NotAvailable>] member x.``Reference - not available``() = x.DoNamedTest()


[<FSharpTest>]
type SimplifyLambdaAvailabilityTest() =
inherit QuickFixAvailabilityTestBase()

override x.RelativeTestDataPath = "features/quickFixes/simplifyLambda"

[<Test>] member x.``To application``() = x.DoNamedTest()
[<Test>] member x.``Simplify lambda``() = x.DoNamedTest()

0 comments on commit 927ca40

Please sign in to comment.