-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
105 additions
and
4 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,39 @@ | ||
package fantomas | ||
|
||
import com.jetbrains.rdclient.testFramework.executeWithGold | ||
import com.jetbrains.rdclient.testFramework.waitForDaemon | ||
import com.jetbrains.rider.test.annotations.TestEnvironment | ||
import com.jetbrains.rider.test.base.EditorTestBase | ||
import com.jetbrains.rider.test.enums.CoreVersion | ||
import com.jetbrains.rider.test.scriptingApi.dumpOpenedDocument | ||
import com.jetbrains.rider.test.scriptingApi.reformatCode | ||
import com.jetbrains.rider.test.scriptingApi.withOpenedEditor | ||
import org.testng.annotations.Test | ||
import withEditorConfig | ||
|
||
@Test | ||
@TestEnvironment(coreVersion = CoreVersion.DEFAULT) | ||
class FantomasTest : EditorTestBase() { | ||
override fun getSolutionDirectoryName() = "FormatCodeApp" | ||
|
||
@Test | ||
fun withEditorConfig() = doTest("EditorConfig.fs") | ||
|
||
@Test | ||
fun simpleFormatting() = doTest("Simple.fs") | ||
|
||
@Test | ||
fun formatLastFile() = doTest("Program.fs") | ||
|
||
private fun doTest(fileName: String) { | ||
withEditorConfig(project) { | ||
withOpenedEditor(fileName) { | ||
waitForDaemon() | ||
reformatCode() | ||
executeWithGold(testGoldFile) { | ||
dumpOpenedDocument(it, project!!, false) | ||
} | ||
} | ||
} | ||
} | ||
} |
2 changes: 2 additions & 0 deletions
2
rider-fsharp/testData/fantomas/FantomasTest/formatLastFile/gold/formatLastFile.gold
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,2 @@ | ||
[<EntryPoint>] | ||
let main argv = 0 |
5 changes: 5 additions & 0 deletions
5
rider-fsharp/testData/fantomas/FantomasTest/simpleFormatting/gold/simpleFormatting.gold
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,5 @@ | ||
module Simple | ||
|
||
type A() = | ||
class | ||
end |
5 changes: 5 additions & 0 deletions
5
rider-fsharp/testData/fantomas/FantomasTest/withEditorConfig/gold/withEditorConfig.gold
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,5 @@ | ||
module EditorConfig | ||
|
||
type A () = | ||
class | ||
end |
16 changes: 16 additions & 0 deletions
16
rider-fsharp/testData/solutions/FormatCodeApp/FormatCodeApp.sln
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,16 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "FormatCodeApp", "FormatCodeApp\FormatCodeApp.fsproj", "{CB87B1A7-9600-4AE2-986C-4333196C6AFE}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{CB87B1A7-9600-4AE2-986C-4333196C6AFE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{CB87B1A7-9600-4AE2-986C-4333196C6AFE}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{CB87B1A7-9600-4AE2-986C-4333196C6AFE}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{CB87B1A7-9600-4AE2-986C-4333196C6AFE}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
EndGlobal |
2 changes: 2 additions & 0 deletions
2
rider-fsharp/testData/solutions/FormatCodeApp/FormatCodeApp/Folder/.editorconfig
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,2 @@ | ||
[*.fs] | ||
fsharp_space_before_class_constructor=true |
3 changes: 3 additions & 0 deletions
3
rider-fsharp/testData/solutions/FormatCodeApp/FormatCodeApp/Folder/EditorConfig.fs
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,3 @@ | ||
module EditorConfig | ||
|
||
type A() = class end |
15 changes: 15 additions & 0 deletions
15
rider-fsharp/testData/solutions/FormatCodeApp/FormatCodeApp/FormatCodeApp.fsproj
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,15 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>netcoreapp3.1</TargetFramework> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<Compile Include="Folder\EditorConfig.fs" /> | ||
<Content Include="Folder\.editorconfig" /> | ||
<Compile Include="Simple.fs" /> | ||
<Compile Include="Program.fs" /> | ||
</ItemGroup> | ||
|
||
</Project> |
2 changes: 2 additions & 0 deletions
2
rider-fsharp/testData/solutions/FormatCodeApp/FormatCodeApp/Program.fs
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,2 @@ | ||
[<EntryPoint>] | ||
let main argv = 0 |
3 changes: 3 additions & 0 deletions
3
rider-fsharp/testData/solutions/FormatCodeApp/FormatCodeApp/Simple.fs
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,3 @@ | ||
module Simple | ||
|
||
type A() = class end |