Skip to content

Commit 617f061

Browse files
committed
Fcs/project model: fix frontend tests
1 parent bf3ca5f commit 617f061

File tree

4 files changed

+80
-75
lines changed

4 files changed

+80
-75
lines changed

rider-fsharp/src/test/kotlin/com/jetbrains/rider/plugins/fsharp/test/Extensions.kt

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,14 +50,25 @@ fun SolutionApiFacade.withDisabledOutOfProcessTypeProviders(function: () -> Unit
5050
}
5151
}
5252

53-
fun SolutionApiFacade.withNonFSharpProjectReferences(function: () -> Unit) {
54-
withSetting(project, "FSharp/FSharpOptions/NonFSharpProjectInMemoryReferences/@EntryValue", "true", "false") {
53+
54+
private fun SolutionApiFacade.withNonFSharpProjectReferencesSetting(enable: Boolean, function: () -> Unit) {
55+
val (enterValue, exitValue) = if (enable) Pair("true", "false") else Pair("false", "true");
56+
withSetting(project, "FSharp/FSharpOptions/NonFSharpProjectInMemoryReferences/@EntryValue", enterValue, exitValue) {
5557
project.fcsHost.updateAssemblyReaderSettings.sync(Unit)
5658
function()
5759
}
5860
project.fcsHost.updateAssemblyReaderSettings.sync(Unit)
5961
}
6062

63+
fun SolutionApiFacade.withNonFSharpProjectReferences(function: () -> Unit) {
64+
withNonFSharpProjectReferencesSetting(true, function)
65+
}
66+
67+
fun SolutionApiFacade.withoutNonFSharpProjectReferences(function: () -> Unit) {
68+
withNonFSharpProjectReferencesSetting(false, function)
69+
}
70+
71+
6172
fun withEditorConfig(project: Project, function: () -> Unit) {
6273
withSetting(project, "CodeStyle/EditorConfig/EnableEditorConfigSupport", "true", "false", function)
6374
}

rider-fsharp/src/test/kotlin/com/jetbrains/rider/plugins/fsharp/test/cases/projectModel/FSharpProjectModelTest.kt

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ class FSharpProjectModelTest : ProjectModelBaseTest() {
4747
}
4848

4949
@Test
50-
@Mute("RIDER-110482")
5150
@TestEnvironment(sdkVersion = SdkVersion.DOT_NET_5)
5251
@Solution("FSharpProjectTree")
5352
fun testFSharpProjectStructure() {
@@ -149,14 +148,12 @@ class FSharpProjectModelTest : ProjectModelBaseTest() {
149148
}
150149

151150
@Test
152-
@Mute("RIDER-110482")
153151
@Issues([Issue("RIDER-69084"), Issue("RIDER-69562")])
154-
@TestEnvironment(sdkVersion = SdkVersion.LATEST_STABLE)
152+
@TestEnvironment(sdkVersion = SdkVersion.DOT_NET_9)
155153
fun testFSharpDirectoryManipulation() {
156154
doTestDumpProjectsView {
157155
dump2("1. Create project", checkSlnFile = false, compareProjFile = true) {
158-
// currently ProjectTemplates.Sdk.Net6 should be used in LATEST_STABLE tests
159-
addProject(project, arrayOf("Solution"), "ClassLibrary", ProjectTemplates.Sdk.Net6.FSharp.classLibrary, targetFramework = "netstandard2.1")
156+
addProject(project, arrayOf("Solution"), "ClassLibrary", ProjectTemplates.Sdk.Net9.FSharp.classLibrary, targetFramework = "netstandard2.1")
160157
}
161158
dump2("2. Create folder 'NewFolder'", checkSlnFile = false, compareProjFile = true) {
162159
addNewFolder(arrayOf("Solution", "ClassLibrary"), "NewFolder")

rider-fsharp/src/test/kotlin/com/jetbrains/rider/plugins/fsharp/test/cases/projectModel/FcsProjectProviderTest.kt

Lines changed: 40 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,10 @@ import com.intellij.testFramework.ProjectViewTestUtil
66
import com.jetbrains.rider.daemon.util.hasErrors
77
import com.jetbrains.rider.editors.getProjectModelId
88
import com.jetbrains.rider.plugins.fsharp.test.fcsHost
9-
import com.jetbrains.rider.plugins.fsharp.test.withNonFSharpProjectReferences
9+
import com.jetbrains.rider.plugins.fsharp.test.withoutNonFSharpProjectReferences
1010
import com.jetbrains.rider.projectView.workspace.containingProjectEntity
1111
import com.jetbrains.rider.projectView.workspace.getId
1212
import com.jetbrains.rider.projectView.workspace.getProjectModelEntity
13-
import com.jetbrains.rider.test.annotations.Mute
1413
import com.jetbrains.rider.test.annotations.Solution
1514
import com.jetbrains.rider.test.annotations.TestEnvironment
1615
import com.jetbrains.rider.test.base.PerTestSolutionTestBase
@@ -85,20 +84,52 @@ class FcsProjectProviderTest : PerTestSolutionTestBase() {
8584
assertHasErrorsAndProjectStampAndReferences("ReferenceFrom/Library.fs", true, emptyList())
8685
}
8786

88-
@Mute("Broken after ProjectModelMonitor refactoring")
8987
@Test
9088
@Solution("ProjectReferencesCSharp")
9189
fun projectReferencesCSharp() {
92-
withNonFSharpProjectReferences {
90+
assertAllProjectsWereLoaded(project)
91+
assertHasErrorsAndProjectStampAndReferences("FSharpProject/Library.fs", true, emptyList())
92+
93+
waitForDaemonCloseAllOpenEditors(project)
94+
addReference(project, arrayOf("ProjectReferencesCSharp", "FSharpProject"), "<CSharpProject>")
95+
assertHasErrorsAndProjectStampAndReferences("FSharpProject/Library.fs", false, listOf("CSharpProject"))
96+
97+
buildSolutionWithReSharperBuild()
98+
assertHasErrorsAndProjectStampAndReferences("FSharpProject/Library.fs", false, listOf("CSharpProject"))
99+
100+
waitForDaemonCloseAllOpenEditors(project)
101+
deleteElement(
102+
project,
103+
arrayOf(
104+
"ProjectReferencesCSharp",
105+
"FSharpProject",
106+
"Dependencies",
107+
".NETStandard 2.0",
108+
"Projects",
109+
"CSharpProject"
110+
)
111+
)
112+
assertHasErrorsAndProjectStampAndReferences("FSharpProject/Library.fs", true, emptyList())
113+
114+
waitForDaemonCloseAllOpenEditors(project)
115+
addReference(project, arrayOf("ProjectReferencesCSharp", "FSharpProject"), "<CSharpProject>")
116+
assertHasErrorsAndProjectStampAndReferences("FSharpProject/Library.fs", false, listOf("CSharpProject"))
117+
}
118+
119+
@Test
120+
@Solution("ProjectReferencesCSharp")
121+
fun projectReferencesCSharpNoModuleReader() {
122+
withoutNonFSharpProjectReferences {
93123
assertAllProjectsWereLoaded(project)
94124
assertHasErrorsAndProjectStampAndReferences("FSharpProject/Library.fs", true, emptyList())
95125

96126
waitForDaemonCloseAllOpenEditors(project)
97127
addReference(project, arrayOf("ProjectReferencesCSharp", "FSharpProject"), "<CSharpProject>")
98-
assertHasErrorsAndProjectStampAndReferences("FSharpProject/Library.fs", false, listOf("CSharpProject"))
128+
assertHasErrorsAndProjectStampAndReferences("FSharpProject/Library.fs", true, emptyList())
99129

130+
waitForDaemonCloseAllOpenEditors(project)
100131
buildSolutionWithReSharperBuild()
101-
assertHasErrorsAndProjectStampAndReferences("FSharpProject/Library.fs", false, listOf("CSharpProject"))
132+
assertHasErrorsAndProjectStampAndReferences("FSharpProject/Library.fs", false, emptyList())
102133

103134
waitForDaemonCloseAllOpenEditors(project)
104135
deleteElement(
@@ -109,49 +140,15 @@ class FcsProjectProviderTest : PerTestSolutionTestBase() {
109140
"Dependencies",
110141
".NETStandard 2.0",
111142
"Projects",
112-
"CSharpProject/1.0.0"
143+
"CSharpProject"
113144
)
114145
)
146+
115147
assertHasErrorsAndProjectStampAndReferences("FSharpProject/Library.fs", true, emptyList())
116148

117149
waitForDaemonCloseAllOpenEditors(project)
118150
addReference(project, arrayOf("ProjectReferencesCSharp", "FSharpProject"), "<CSharpProject>")
119-
assertHasErrorsAndProjectStampAndReferences("FSharpProject/Library.fs", false, listOf("CSharpProject"))
151+
assertHasErrorsAndProjectStampAndReferences("FSharpProject/Library.fs", false, emptyList())
120152
}
121153
}
122-
123-
@Mute("RIDER-100270 Need to somehow set setting before solution load")
124-
@Test
125-
@Solution("ProjectReferencesCSharp")
126-
fun projectReferencesCSharpNoModuleReader() {
127-
assertAllProjectsWereLoaded(project)
128-
assertHasErrorsAndProjectStampAndReferences("FSharpProject/Library.fs", true, emptyList())
129-
130-
waitForDaemonCloseAllOpenEditors(project)
131-
addReference(project, arrayOf("ProjectReferencesCSharp", "FSharpProject"), "<CSharpProject>")
132-
assertHasErrorsAndProjectStampAndReferences("FSharpProject/Library.fs", true, emptyList())
133-
134-
waitForDaemonCloseAllOpenEditors(project)
135-
buildSolutionWithReSharperBuild()
136-
assertHasErrorsAndProjectStampAndReferences("FSharpProject/Library.fs", false, emptyList())
137-
138-
waitForDaemonCloseAllOpenEditors(project)
139-
deleteElement(
140-
project,
141-
arrayOf(
142-
"ProjectReferencesCSharp",
143-
"FSharpProject",
144-
"Dependencies",
145-
".NETStandard 2.0",
146-
"Projects",
147-
"CSharpProject/1.0.0"
148-
)
149-
)
150-
151-
assertHasErrorsAndProjectStampAndReferences("FSharpProject/Library.fs", true, emptyList())
152-
153-
waitForDaemonCloseAllOpenEditors(project)
154-
addReference(project, arrayOf("ProjectReferencesCSharp", "FSharpProject"), "<CSharpProject>")
155-
assertHasErrorsAndProjectStampAndReferences("FSharpProject/Library.fs", false, emptyList())
156-
}
157154
}

rider-fsharp/src/test/testData/projectModel/FSharpProjectModelTest/testFSharpDirectoryManipulation/gold/testFSharpDirectoryManipulation.gold

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
-Implicit
1111
...
1212
-Packages
13-
FSharp.Core/6.0.7
13+
FSharp.Core/9.0.100
1414
-Frameworks
1515
NETStandard.Library
1616
Library.fs
@@ -30,7 +30,7 @@ Project [Name:ClassLibrary, GUID:GUID]
3030
Child items:
3131
Folder [Name:netstandard2.1, IsHidden:true]
3232
Child items:
33-
ProjectFileImpl(Path : ClassLibrary.AssemblyInfo.fs)[Hidden COMPILEBEFORE ]
33+
ProjectFileImpl(Path : ClassLibrary.AssemblyInfo.fs)[Hidden COMPILE Properties:CompileOrder=CompileBefore]
3434

3535
Project [Name:Miscellaneous Files, GUID:GUID]
3636

@@ -47,13 +47,13 @@ Content roots:
4747
1:obj[1]
4848
1:Debug[1]
4949
1:netstandard2.1[1]
50-
1:.NETStandard,Version=v2.1.AssemblyAttributes.fs (CompileBefore)
51-
2:ClassLibrary.AssemblyInfo.fs (CompileBefore)
50+
1:ClassLibrary.AssemblyInfo.fs
51+
2:.NETStandard,Version=v2.1.AssemblyAttributes.fs
5252
2:Library.fs
5353

5454
.NETStandard,Version=v2.1
55-
obj/Debug/netstandard2.1/.NETStandard,Version=v2.1.AssemblyAttributes.fs
5655
obj/Debug/netstandard2.1/ClassLibrary.AssemblyInfo.fs
56+
obj/Debug/netstandard2.1/.NETStandard,Version=v2.1.AssemblyAttributes.fs
5757
Library.fs
5858

5959
===================
@@ -68,7 +68,7 @@ Library.fs
6868
-Implicit
6969
...
7070
-Packages
71-
FSharp.Core/6.0.7
71+
FSharp.Core/9.0.100
7272
-Frameworks
7373
NETStandard.Library
7474
Library.fs
@@ -90,7 +90,7 @@ Project [Name:ClassLibrary, GUID:GUID]
9090
Child items:
9191
Folder [Name:netstandard2.1, IsHidden:true]
9292
Child items:
93-
ProjectFileImpl(Path : ClassLibrary.AssemblyInfo.fs)[Hidden COMPILEBEFORE ]
93+
ProjectFileImpl(Path : ClassLibrary.AssemblyInfo.fs)[Hidden COMPILE Properties:CompileOrder=CompileBefore]
9494

9595
Project [Name:Miscellaneous Files, GUID:GUID]
9696

@@ -107,14 +107,14 @@ Content roots:
107107
1:obj[1]
108108
1:Debug[1]
109109
1:netstandard2.1[1]
110-
1:.NETStandard,Version=v2.1.AssemblyAttributes.fs (CompileBefore)
111-
2:ClassLibrary.AssemblyInfo.fs (CompileBefore)
110+
1:ClassLibrary.AssemblyInfo.fs
111+
2:.NETStandard,Version=v2.1.AssemblyAttributes.fs
112112
2:Library.fs
113113
3:NewFolder[1]
114114

115115
.NETStandard,Version=v2.1
116-
obj/Debug/netstandard2.1/.NETStandard,Version=v2.1.AssemblyAttributes.fs
117116
obj/Debug/netstandard2.1/ClassLibrary.AssemblyInfo.fs
117+
obj/Debug/netstandard2.1/.NETStandard,Version=v2.1.AssemblyAttributes.fs
118118
Library.fs
119119

120120
===================
@@ -129,7 +129,7 @@ Library.fs
129129
-Implicit
130130
...
131131
-Packages
132-
FSharp.Core/6.0.7
132+
FSharp.Core/9.0.100
133133
-Frameworks
134134
NETStandard.Library
135135
Library.fs
@@ -154,7 +154,7 @@ Project [Name:ClassLibrary, GUID:GUID]
154154
Child items:
155155
Folder [Name:netstandard2.1, IsHidden:true]
156156
Child items:
157-
ProjectFileImpl(Path : ClassLibrary.AssemblyInfo.fs)[Hidden COMPILEBEFORE ]
157+
ProjectFileImpl(Path : ClassLibrary.AssemblyInfo.fs)[Hidden COMPILE Properties:CompileOrder=CompileBefore]
158158

159159
Project [Name:Miscellaneous Files, GUID:GUID]
160160

@@ -171,15 +171,15 @@ Content roots:
171171
1:obj[1]
172172
1:Debug[1]
173173
1:netstandard2.1[1]
174-
1:.NETStandard,Version=v2.1.AssemblyAttributes.fs (CompileBefore)
175-
2:ClassLibrary.AssemblyInfo.fs (CompileBefore)
174+
1:ClassLibrary.AssemblyInfo.fs
175+
2:.NETStandard,Version=v2.1.AssemblyAttributes.fs
176176
2:Library.fs
177177
3:NewFolder[1]
178178
1:NewSub[1]
179179

180180
.NETStandard,Version=v2.1
181-
obj/Debug/netstandard2.1/.NETStandard,Version=v2.1.AssemblyAttributes.fs
182181
obj/Debug/netstandard2.1/ClassLibrary.AssemblyInfo.fs
182+
obj/Debug/netstandard2.1/.NETStandard,Version=v2.1.AssemblyAttributes.fs
183183
Library.fs
184184

185185
===================
@@ -194,7 +194,7 @@ Library.fs
194194
-Implicit
195195
...
196196
-Packages
197-
FSharp.Core/6.0.7
197+
FSharp.Core/9.0.100
198198
-Frameworks
199199
NETStandard.Library
200200
Library.fs
@@ -218,7 +218,7 @@ Project [Name:ClassLibrary, GUID:GUID]
218218
Child items:
219219
Folder [Name:netstandard2.1, IsHidden:true]
220220
Child items:
221-
ProjectFileImpl(Path : ClassLibrary.AssemblyInfo.fs)[Hidden COMPILEBEFORE ]
221+
ProjectFileImpl(Path : ClassLibrary.AssemblyInfo.fs)[Hidden COMPILE Properties:CompileOrder=CompileBefore]
222222

223223
Project [Name:Miscellaneous Files, GUID:GUID]
224224

@@ -235,15 +235,15 @@ Content roots:
235235
1:obj[1]
236236
1:Debug[1]
237237
1:netstandard2.1[1]
238-
1:.NETStandard,Version=v2.1.AssemblyAttributes.fs (CompileBefore)
239-
2:ClassLibrary.AssemblyInfo.fs (CompileBefore)
238+
1:ClassLibrary.AssemblyInfo.fs
239+
2:.NETStandard,Version=v2.1.AssemblyAttributes.fs
240240
2:Library.fs
241241
3:NewSub[1]
242242
4:NewFolder[1]
243243

244244
.NETStandard,Version=v2.1
245-
obj/Debug/netstandard2.1/.NETStandard,Version=v2.1.AssemblyAttributes.fs
246245
obj/Debug/netstandard2.1/ClassLibrary.AssemblyInfo.fs
246+
obj/Debug/netstandard2.1/.NETStandard,Version=v2.1.AssemblyAttributes.fs
247247
Library.fs
248248

249249
===================
@@ -258,7 +258,7 @@ Library.fs
258258
-Implicit
259259
...
260260
-Packages
261-
FSharp.Core/6.0.7
261+
FSharp.Core/9.0.100
262262
-Frameworks
263263
NETStandard.Library
264264
Library.fs
@@ -280,7 +280,7 @@ Project [Name:ClassLibrary, GUID:GUID]
280280
Child items:
281281
Folder [Name:netstandard2.1, IsHidden:true]
282282
Child items:
283-
ProjectFileImpl(Path : ClassLibrary.AssemblyInfo.fs)[Hidden COMPILEBEFORE ]
283+
ProjectFileImpl(Path : ClassLibrary.AssemblyInfo.fs)[Hidden COMPILE Properties:CompileOrder=CompileBefore]
284284

285285
Project [Name:Miscellaneous Files, GUID:GUID]
286286

@@ -297,13 +297,13 @@ Content roots:
297297
1:obj[1]
298298
1:Debug[1]
299299
1:netstandard2.1[1]
300-
1:.NETStandard,Version=v2.1.AssemblyAttributes.fs (CompileBefore)
301-
2:ClassLibrary.AssemblyInfo.fs (CompileBefore)
300+
1:ClassLibrary.AssemblyInfo.fs
301+
2:.NETStandard,Version=v2.1.AssemblyAttributes.fs
302302
2:Library.fs
303303
3:NewFolder[1]
304304

305305
.NETStandard,Version=v2.1
306-
obj/Debug/netstandard2.1/.NETStandard,Version=v2.1.AssemblyAttributes.fs
307306
obj/Debug/netstandard2.1/ClassLibrary.AssemblyInfo.fs
307+
obj/Debug/netstandard2.1/.NETStandard,Version=v2.1.AssemblyAttributes.fs
308308
Library.fs
309309

0 commit comments

Comments
 (0)