Skip to content

Add unit tests for Rust resolver #6

@Jaydeep869

Description

@Jaydeep869

Description

The Rust resolver currently lacks unit tests. With PRs #2 and #3 adding tests for JavaScript, Python, and Go resolvers, we should complete test coverage for the Rust resolver as well.

Motivation

  • Ensures Rust package resolution works correctly
  • Prevents regressions in Cargo path parsing
  • Maintains consistency with other ecosystem resolvers
  • Critical for production readiness

Scope

  • Create pkg/resolver/rust_test.go
  • Test Cargo registry path parsing (e.g., registry/src/github.com-1ecc6299db9ec823/serde-1.0.130)
  • Test version extraction from paths
  • Test PURL generation (pkg:cargo/serde@1.0.130)
  • Test edge cases (invalid paths, malformed versions)
  • Test package file filtering
  • Minimum 5-8 comprehensive test cases

Example Test Cases

  1. Valid Cargo registry path → correct package info
  2. Scoped package name handling
  3. Version extraction from path
  4. PURL format validation
  5. Invalid path handling
  6. Package file filter matching

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions