@@ -1974,6 +1974,70 @@ func TestPom_Parse(t *testing.T) {
1974
1974
},
1975
1975
},
1976
1976
},
1977
+ //[INFO] com.example:root-pom-with-spaces:jar:1.0.0
1978
+ //[INFO] \- org.example:example-nested:jar:3.3.3:compile
1979
+ //[INFO] \- org.example:example-dependency:jar:1.2.4:compile
1980
+ //[INFO] \- org.example:example-api:jar:2.0.0:compile
1981
+ {
1982
+ name : "space at the start and/or end of the text nodes" ,
1983
+ inputFile : filepath .Join ("testdata" , "with-spaces" , "pom.xml" ),
1984
+ local : true ,
1985
+ want : []ftypes.Package {
1986
+ {
1987
+ ID : "com.example:root-pom-with-spaces:1.0.0" ,
1988
+ Name : "com.example:root-pom-with-spaces" ,
1989
+ Version : "1.0.0" ,
1990
+ Relationship : ftypes .RelationshipRoot ,
1991
+ },
1992
+ {
1993
+ ID : "org.example:example-nested:3.3.3" ,
1994
+ Name : "org.example:example-nested" ,
1995
+ Version : "3.3.3" ,
1996
+ Relationship : ftypes .RelationshipDirect ,
1997
+ Locations : ftypes.Locations {
1998
+ {
1999
+ StartLine : 24 ,
2000
+ EndLine : 28 ,
2001
+ },
2002
+ },
2003
+ },
2004
+ {
2005
+ ID : "org.example:example-api:2.0.0" ,
2006
+ Name : "org.example:example-api" ,
2007
+ Version : "2.0.0" ,
2008
+ Licenses : []string {"The Apache Software License, Version 2.0" },
2009
+ Relationship : ftypes .RelationshipIndirect ,
2010
+ },
2011
+ // dependency version is taken from `com.example:root-pom-with-spaces` from dependencyManagement
2012
+ // not from `com.example:example-nested` from `com.example:example-nested`
2013
+ {
2014
+ ID : "org.example:example-dependency:1.2.4" ,
2015
+ Name : "org.example:example-dependency" ,
2016
+ Version : "1.2.4" ,
2017
+ Relationship : ftypes .RelationshipIndirect ,
2018
+ },
2019
+ },
2020
+ wantDeps : []ftypes.Dependency {
2021
+ {
2022
+ ID : "com.example:root-pom-with-spaces:1.0.0" ,
2023
+ DependsOn : []string {
2024
+ "org.example:example-nested:3.3.3" ,
2025
+ },
2026
+ },
2027
+ {
2028
+ ID : "org.example:example-dependency:1.2.4" ,
2029
+ DependsOn : []string {
2030
+ "org.example:example-api:2.0.0" ,
2031
+ },
2032
+ },
2033
+ {
2034
+ ID : "org.example:example-nested:3.3.3" ,
2035
+ DependsOn : []string {
2036
+ "org.example:example-dependency:1.2.4" ,
2037
+ },
2038
+ },
2039
+ },
2040
+ },
1977
2041
}
1978
2042
for _ , tt := range tests {
1979
2043
t .Run (tt .name , func (t * testing.T ) {
0 commit comments