@@ -351,7 +351,7 @@ func TestCargoLockWithGitDependencies(t *testing.T) {
351351 helloWorld := pkg.Package {
352352 Name : "hello_world" ,
353353 Version : "0.1.0" ,
354- PURL : "pkg:cargo/hello_world@0.1.0 " ,
354+ PURL : "" ,
355355 Locations : locations ,
356356 Language : pkg .Rust ,
357357 Type : pkg .RustPkg ,
@@ -673,6 +673,77 @@ func TestCargoLockWithGitDependencies(t *testing.T) {
673673 pkgtest .TestFileParser (t , fixture , parseCargoLock , expectedPkgs , expectedRelationships )
674674}
675675
676+ func TestCargoLockWithPathDependencies (t * testing.T ) {
677+ fixture := "testdata/path-deps/Cargo.lock"
678+ locations := file .NewLocationSet (file .NewLocation (fixture ))
679+
680+ app := pkg.Package {
681+ Name : "app" ,
682+ Version : "1.0.0" ,
683+ Locations : locations ,
684+ Language : pkg .Rust ,
685+ Type : pkg .RustPkg ,
686+ Licenses : pkg .NewLicenseSet (),
687+ Metadata : pkg.RustCargoLockEntry {
688+ Name : "app" ,
689+ Version : "1.0.0" ,
690+ Dependencies : []string {
691+ "memchr" ,
692+ "telemetry" ,
693+ },
694+ },
695+ }
696+ memchr := pkg.Package {
697+ Name : "memchr" ,
698+ Version : "2.7.4" ,
699+ PURL : "pkg:cargo/memchr@2.7.4" ,
700+ Locations : locations ,
701+ Language : pkg .Rust ,
702+ Type : pkg .RustPkg ,
703+ Licenses : pkg .NewLicenseSet (),
704+ Metadata : pkg.RustCargoLockEntry {
705+ Name : "memchr" ,
706+ Version : "2.7.4" ,
707+ Source : "registry+https://github.com/rust-lang/crates.io-index" ,
708+ Checksum : "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" ,
709+ Dependencies : []string {},
710+ },
711+ }
712+ telemetry := pkg.Package {
713+ Name : "telemetry" ,
714+ Version : "0.1.0" ,
715+ Locations : locations ,
716+ Language : pkg .Rust ,
717+ Type : pkg .RustPkg ,
718+ Licenses : pkg .NewLicenseSet (),
719+ Metadata : pkg.RustCargoLockEntry {
720+ Name : "telemetry" ,
721+ Version : "0.1.0" ,
722+ Dependencies : []string {},
723+ },
724+ }
725+
726+ expectedPkgs := []pkg.Package {
727+ app ,
728+ memchr ,
729+ telemetry ,
730+ }
731+ expectedRelationships := []artifact.Relationship {
732+ {
733+ From : memchr ,
734+ To : app ,
735+ Type : artifact .DependencyOfRelationship ,
736+ },
737+ {
738+ From : telemetry ,
739+ To : app ,
740+ Type : artifact .DependencyOfRelationship ,
741+ },
742+ }
743+
744+ pkgtest .TestFileParser (t , fixture , parseCargoLock , expectedPkgs , expectedRelationships )
745+ }
746+
676747func TestCargoLockDependencySpecification (t * testing.T ) {
677748 tests := []struct {
678749 name string
0 commit comments