Skip to content

Commit

Permalink
test: check properties for nested depManagement
Browse files Browse the repository at this point in the history
  • Loading branch information
DmitriyLewen committed Jan 22, 2024
1 parent 710b6cc commit 3044025
Show file tree
Hide file tree
Showing 5 changed files with 107 additions and 5 deletions.
43 changes: 42 additions & 1 deletion pkg/golang/mod/testdata/no-go-version/go.mod
Original file line number Diff line number Diff line change
@@ -1,3 +1,44 @@
module github.com/org/repo

require github.com/aquasecurity/go-dep-parser v0.0.0-20211224170007-df43bca6b6ff
go 1.21.1

require github.com/aquasecurity/go-dep-parser v0.0.0-20211224170007-df43bca6b6ff

require (
github.com/BurntSushi/toml v0.4.1 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/google/renameio v0.1.0 // indirect
github.com/hashicorp/errwrap v1.0.0 // indirect
github.com/hashicorp/go-cleanhttp v0.5.1 // indirect
github.com/hashicorp/go-hclog v0.9.2 // indirect
github.com/hashicorp/go-multierror v1.1.1 // indirect
github.com/hashicorp/go-retryablehttp v0.7.0 // indirect
github.com/kisielk/gotool v1.0.0 // indirect
github.com/kr/pretty v0.1.0 // indirect
github.com/kr/pty v1.1.1 // indirect
github.com/kr/text v0.1.0 // indirect
github.com/pkg/errors v0.8.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/rogpeppe/go-internal v1.3.0 // indirect
github.com/stretchr/objx v0.1.0 // indirect
github.com/stretchr/testify v1.7.0 // indirect
go.uber.org/atomic v1.6.0 // indirect
go.uber.org/multierr v1.5.0 // indirect
go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee // indirect
go.uber.org/zap v1.16.0 // indirect
golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529 // indirect
golang.org/x/lint v0.0.0-20190930215403-16217165b5de // indirect
golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e // indirect
golang.org/x/net v0.0.0-20210119194325-5f4716e94777 // indirect
golang.org/x/sync v0.0.0-20190423024810-112230192c58 // indirect
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68 // indirect
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1 // indirect
golang.org/x/text v0.3.3 // indirect
golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5 // indirect
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 // indirect
gopkg.in/errgo.v2 v2.1.0 // indirect
gopkg.in/yaml.v2 v2.2.2 // indirect
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c // indirect
honnef.co/go/tools v0.0.1-2019.2.3 // indirect
)
6 changes: 3 additions & 3 deletions pkg/java/pom/parse_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -562,16 +562,16 @@ func TestPom_Parse(t *testing.T) {
License: "Apache 2.0",
},
{
ID: "org.example:example-api:1.1.1",
ID: "org.example:example-api:2.2.2",
Name: "org.example:example-api",
Version: "1.1.1",
Version: "2.2.2",
},
},
wantDeps: []types.Dependency{
{
ID: "com.example:import:2.0.0",
DependsOn: []string{
"org.example:example-api:1.1.1",
"org.example:example-api:2.2.2",
},
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,19 @@
<dependency>
<groupId>org.example</groupId>
<artifactId>example-dependency-management2</artifactId>
<version>1.1.1</version>
<version>${project.version}</version>
<scope>import</scope>
<type>pom</type>
</dependency>
</dependencies>
</dependencyManagement>

<dependencies>
<dependency>
<groupId>org.example</groupId>
<artifactId>example-dependency</artifactId>
<version>1.2.3</version>
</dependency>
</dependencies>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

<modelVersion>4.0.0</modelVersion>

<groupId>org.example</groupId>
<artifactId>example-dependency-management2</artifactId>
<version>3.3.3</version>

<packaging>pom</packaging>
<name>Example API Dependency Management</name>
<description>The example API</description>

<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.example</groupId>
<artifactId>example-dependency-management3</artifactId>
<version>2.2.2</version>
<scope>import</scope>
<type>pom</type>
</dependency>
</dependencies>
</dependencyManagement>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

<modelVersion>4.0.0</modelVersion>

<groupId>org.example</groupId>
<artifactId>example-dependency-management3</artifactId>
<version>2.2.2</version>

<packaging>pom</packaging>
<name>Example API Dependency Management</name>
<description>The example API</description>

<!-- This dependencyManagement doesn't affect dependencies of example-dependency-->
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.example</groupId>
<artifactId>example-api</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
</dependencyManagement>

</project>

0 comments on commit 3044025

Please sign in to comment.