Skip to content

Commit

Permalink
Add failing test scenarios
Browse files Browse the repository at this point in the history
  • Loading branch information
bording committed Jan 26, 2024
1 parent 6efbf16 commit 74b72b6
Showing 1 changed file with 52 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -462,6 +462,32 @@ public static IEnumerable<object[]> GetTopLevelPackageDependenyInfosTestData()
}
};

// version is a property not triggered by a quoted condition
yield return new object[]
{
// build file contents
new[]
{
("project.csproj", """
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<NewtonsoftJsonVersion>12.0.1</NewtonsoftJsonVersion>
<NewtonsoftJsonVersion Condition="'$(PropertyThatDoesNotExist)' == 'true'">13.0.1</NewtonsoftJsonVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="$(NewtonsoftJsonVersion)" />
</ItemGroup>
</Project>
""")
},
// expected dependencies
new Dependency[]
{
new("Newtonsoft.Json", "12.0.1", DependencyType.Unknown)
}
};

// version is a property with a condition checking for an empty string
yield return new object[]
{
Expand All @@ -488,6 +514,32 @@ public static IEnumerable<object[]> GetTopLevelPackageDependenyInfosTestData()
}
};

// version is a property with a quoted condition checking for an empty string
yield return new object[]
{
// build file contents
new[]
{
("project.csproj", """
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<NewtonsoftJsonVersion Condition="'$(NewtonsoftJsonVersion)' == ''">12.0.1</NewtonsoftJsonVersion>
<NewtonsoftJsonVersion Condition="'$(PropertyThatDoesNotExist)' == 'true'">13.0.1</NewtonsoftJsonVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="$(NewtonsoftJsonVersion)" />
</ItemGroup>
</Project>
""")
},
// expected dependencies
new Dependency[]
{
new("Newtonsoft.Json", "12.0.1", DependencyType.Unknown)
}
};

// version is set in one file, used in another
yield return new object[]
{
Expand Down

0 comments on commit 74b72b6

Please sign in to comment.