Skip to content

Commit d838e00

Browse files
committed
Fix .slnf and .slnx test cases in ProjectLoader2Tests
- Uncommented sample12 (.slnf) and sample14 (.slnx) tests. - Implemented 'expandEntryPoints' helper in ProjectLoader2Tests. - Updated test logic to parse .sln, .slnf, and .slnx files using InspectSln before passing them to ProjectLoader2 or dotnet restore. - This bypasses MSBuild Graph API limitations regarding these specific solution formats by feeding it the underlying project files directly.
1 parent d29691f commit d838e00

File tree

1 file changed

+19
-11
lines changed

1 file changed

+19
-11
lines changed

test/Ionide.ProjInfo.Tests/ProjectLoader2Tests.fs

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,24 @@ module ProjectLoader2Tests =
6969
abstract member Load: paths: string list * ct: CancellationToken -> Task<seq<Result<BuildResult, BuildResult * ErrorLogger>>>
7070

7171

72+
let expandEntryPoints (entrypoints: string seq) =
73+
entrypoints
74+
|> Seq.collect (fun p ->
75+
let ext = Path.GetExtension(p).ToLowerInvariant()
76+
if ext = ".sln" || ext = ".slnf" || ext = ".slnx" then
77+
p
78+
|> InspectSln.tryParseSln
79+
|> getResult
80+
|> InspectSln.loadingBuildOrder
81+
else
82+
[ p ]
83+
)
84+
7285
let parseWithGraph (env: TestEnv) =
7386
task {
7487
let entrypoints =
7588
env.Entrypoints
89+
|> expandEntryPoints
7690
|> Seq.map ProjectGraphEntryPoint
7791

7892
let loggers = env.Binlog.Loggers env.Binlog.File.Name
@@ -112,15 +126,8 @@ module ProjectLoader2Tests =
112126

113127
let entrypoints =
114128
path
115-
|> Seq.collect (fun p ->
116-
if p.EndsWith(".sln") then
117-
p
118-
|> InspectSln.tryParseSln
119-
|> getResult
120-
|> InspectSln.loadingBuildOrder
121-
else
122-
[ p ]
123-
)
129+
|> expandEntryPoints
130+
124131
// Evaluation
125132
use pc = projectCollection ()
126133

@@ -187,6 +194,7 @@ module ProjectLoader2Tests =
187194
match restore with
188195
| DoRestore ->
189196
entrypoints
197+
|> expandEntryPoints
190198
|> Seq.iter (fun x ->
191199
dotnet fs [
192200
"restore"
@@ -271,9 +279,9 @@ module ProjectLoader2Tests =
271279
// yield! applyTests "sample-workload" ``sample-workload``
272280
yield! applyTests "traversal-project" ``traversal-project``
273281
yield! applyTests "sample11-solution-with-other-projects" ``sample11-solution-with-other-projects``
274-
// yield! applyTests "sample12-solution-filter-with-one-project" ``sample12-solution-filter-with-one-project``
282+
yield! applyTests "sample12-solution-filter-with-one-project" ``sample12-solution-filter-with-one-project``
275283
yield! applyTests "sample13-solution-with-solution-files" ``sample13-solution-with-solution-files``
276-
// yield! applyTests "sample-14-slnx-solution" ``sample-14-slnx-solution``
284+
yield! applyTests "sample-14-slnx-solution" ``sample-14-slnx-solution``
277285
yield! applyTests "sample15-nuget-analyzers" ``sample15-nuget-analyzers``
278286
yield! applyTests "sample16-solution-with-solution-folders" ``sample16-solution-with-solution-folders``
279287
yield! applyTests "sample-netsdk-prodref" ``sample-netsdk-prodref``

0 commit comments

Comments
 (0)