forked from aquasecurity/trivy
-
Notifications
You must be signed in to change notification settings - Fork 0
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
1 parent
2145464
commit 9c0752a
Showing
7 changed files
with
122 additions
and
20 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
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 |
---|---|---|
|
@@ -44,6 +44,54 @@ func Test_nugetibraryAnalyzer_Analyze(t *testing.T) { | |
}, | ||
}, | ||
}, | ||
{ | ||
name: "happy path packages.props file.", | ||
dir: "testdata/packagesProps", | ||
want: &analyzer.AnalysisResult{ | ||
Applications: []types.Application{ | ||
{ | ||
Type: types.NuGet, | ||
FilePath: "packages.props", | ||
Libraries: types.Packages{ | ||
{ | ||
ID: "[email protected]", | ||
Name: "Package1", | ||
Version: "22.1.4", | ||
}, | ||
{ | ||
ID: "[email protected]", | ||
Name: "Package2", | ||
Version: "2.3.0", | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
{ | ||
name: "happy path directory.packages.props file.", | ||
dir: "testdata/directoryPackagesProps", | ||
want: &analyzer.AnalysisResult{ | ||
Applications: []types.Application{ | ||
{ | ||
Type: types.NuGet, | ||
FilePath: "Directory.Packages.props", | ||
Libraries: types.Packages{ | ||
{ | ||
ID: "[email protected]", | ||
Name: "Package1", | ||
Version: "4.2.1", | ||
}, | ||
{ | ||
ID: "[email protected]", | ||
Name: "Package2", | ||
Version: "8.2.0", | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
{ | ||
name: "happy path lock file.", | ||
dir: "testdata/lock", | ||
|
@@ -217,6 +265,16 @@ func Test_nugetLibraryAnalyzer_Required(t *testing.T) { | |
filePath: "test/packages.lock.json", | ||
want: true, | ||
}, | ||
{ | ||
name: "packagesProps", | ||
filePath: "test/packages.props", | ||
want: true, | ||
}, | ||
{ | ||
name: "directoryPackagesProps", | ||
filePath: "test/Directory.Packages.props", | ||
want: true, | ||
}, | ||
{ | ||
name: "zip", | ||
filePath: "test.zip", | ||
|
7 changes: 7 additions & 0 deletions
7
...l/analyzer/language/dotnet/nuget/testdata/directoryPackagesProps/Directory.Packages.props
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,7 @@ | ||
<Project> | ||
|
||
<ItemGroup> | ||
<PackageVersion Include="Package1" Version="4.2.1" /> | ||
<PackageVersion Include="Package2" Version="8.2.0" /> | ||
</ItemGroup> | ||
</Project> |
9 changes: 9 additions & 0 deletions
9
pkg/fanal/analyzer/language/dotnet/nuget/testdata/packagesProps/packages.props
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,9 @@ | ||
<Project> | ||
|
||
<ItemGroup> | ||
|
||
<PackageVersion Include="Package1" Version="22.1.4" /> | ||
<PackageVersion Include="Package2" Version="2.3.0" /> | ||
|
||
</ItemGroup> | ||
</Project> |
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