Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions test/Ionide.ProjInfo.Tests/TestAssets.fs
Original file line number Diff line number Diff line change
Expand Up @@ -357,3 +357,12 @@ let ``sample 13 sln with solution files`` = {
TargetFrameworks = Map.empty
ProjectReferences = []
}

// A test with a .slnx format solution file
let ``sample 14 slnx solution`` = {
ProjDir = "sample-14-slnx-solution"
AssemblyName = ""
ProjectFile = "sample-14-slnx-solution.slnx"
TargetFrameworks = Map.empty
ProjectReferences = []
}
25 changes: 25 additions & 0 deletions test/Ionide.ProjInfo.Tests/Tests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -2331,6 +2331,28 @@ let sample13SolutionFilesTest toolsPath loaderType workspaceFactory =
| _ -> failtestf "Expected a folder, but got %A" solutionItem.Kind
)

let sample14SlnxFileTest toolsPath loaderType workspaceFactory =
testCase
$"Can load sample14 slnx file test - {loaderType}"
(fun () ->

let projPath = pathForProject ``sample 14 slnx solution``
let slnDir = Path.GetDirectoryName projPath

let solutionContents =
InspectSln.tryParseSln projPath
|> getResult

let expectedProject = solutionContents.Items[0]

let expectedProjectPath = Path.Combine(slnDir, "proj1", "proj1.fsproj")
Expect.equal expectedProject.Name expectedProjectPath "Should have the expected project path"

match expectedProject.Kind with
| InspectSln.MSBuildFormat items -> Expect.isEmpty items "we don't currently store anything here"
| _ -> failtestf "Expected a project, but got %A" expectedProject.Kind
)

let tests toolsPath =
let testSample3WorkspaceLoaderExpected = [
ExpectNotification.loading "c1.fsproj"
Expand Down Expand Up @@ -2466,4 +2488,7 @@ let tests toolsPath =

sample13SolutionFilesTest toolsPath (nameof (WorkspaceLoader)) WorkspaceLoader.Create
sample13SolutionFilesTest toolsPath (nameof (WorkspaceLoaderViaProjectGraph)) WorkspaceLoaderViaProjectGraph.Create

sample14SlnxFileTest toolsPath (nameof (WorkspaceLoader)) WorkspaceLoader.Create
sample14SlnxFileTest toolsPath (nameof (WorkspaceLoaderViaProjectGraph)) WorkspaceLoaderViaProjectGraph.Create
]
5 changes: 5 additions & 0 deletions test/examples/sample-14-slnx-solution/proj1/Library.fs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
namespace proj1

module Say =
let hello name =
printfn "Hello %s" name
12 changes: 12 additions & 0 deletions test/examples/sample-14-slnx-solution/proj1/proj1.fsproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
</PropertyGroup>

<ItemGroup>
<Compile Include="Library.fs" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<Solution>
<Project Path="proj1/proj1.fsproj" />
</Solution>