Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing handling of pkg:cpan causes tests to fail #78

Open
petergardfjall opened this issue Feb 26, 2025 · 1 comment
Open

Missing handling of pkg:cpan causes tests to fail #78

petergardfjall opened this issue Feb 26, 2025 · 1 comment

Comments

@petergardfjall
Copy link
Contributor

petergardfjall commented Feb 26, 2025

Unit tests are currently failing on master because the implementation does not properly validate pkg:cpan as prescribed by the spec.

That, I reckon, is a major downside of keeping tests in a separate repository.

$ make test 
curl -Ls https://raw.githubusercontent.com/package-url/purl-spec/master/test-suite-data.json -o testdata/test-suite-data.json
go test -v -cover ./...
=== RUN   TestFromStringExamples
    packageurl_test.go:183: cpan module name like distribution name did not fail and returned packageurl.PackageURL{Type:"cpan", Namespace:"", Name:"Perl-Version", Version:"1.013", Qualifiers:packageurl.Qualifiers{}, Subpath:""}
    packageurl_test.go:183: cpan distribution name like module name did not fail and returned packageurl.PackageURL{Type:"cpan", Namespace:"GDT", Name:"URI::PackageURL", Version:"2.11", Qualifiers:packageurl.Qualifiers{}, Subpath:""}
--- FAIL: TestFromStringExamples (0.00s)
=== RUN   TestToStringExamples
--- PASS: TestToStringExamples (0.00s)
=== RUN   TestStringer
--- PASS: TestStringer (0.00s)
=== RUN   TestQualifiersMapConversion
--- PASS: TestQualifiersMapConversion (0.00s)
=== RUN   TestNameEscaping
=== RUN   TestNameEscaping/abc
=== RUN   TestNameEscaping/ab/c
--- PASS: TestNameEscaping (0.00s)
    --- PASS: TestNameEscaping/abc (0.00s)
    --- PASS: TestNameEscaping/ab/c (0.00s)
=== RUN   TestQualifierMissingEqual
--- PASS: TestQualifierMissingEqual (0.00s)
=== RUN   TestNormalize
=== RUN   TestNormalize/type_is_case_insensitive
=== RUN   TestNormalize/type_is_manditory
=== RUN   TestNormalize/leading_and_traling_/_on_namespace_are_trimmed
=== RUN   TestNormalize/qualifiers_with_empty_values_are_removed
=== RUN   TestNormalize/qualifiers_are_sorted_by_key
=== RUN   TestNormalize/duplicate_keys_are_invalid
=== RUN   TestNormalize/keys_are_made_lower_case
=== RUN   TestNormalize/name_is_required
=== RUN   TestNormalize/leading_and_traling_/_on_subpath_are_trimmed
=== RUN   TestNormalize/'.'_is_an_invalid_subpath_segment
=== RUN   TestNormalize/'..'_is_an_invalid_subpath_segment
=== RUN   TestNormalize/'./'_is_a_valid_subpath_prefix
=== RUN   TestNormalize/'../'_is_a_valid_subpath_prefix
=== RUN   TestNormalize/known_type_namespace_adjustments
=== RUN   TestNormalize/known_type_name_adjustments
=== RUN   TestNormalize/known_type_version_adjustments
--- PASS: TestNormalize (0.00s)
    --- PASS: TestNormalize/type_is_case_insensitive (0.00s)
    --- PASS: TestNormalize/type_is_manditory (0.00s)
    --- PASS: TestNormalize/leading_and_traling_/_on_namespace_are_trimmed (0.00s)
    --- PASS: TestNormalize/qualifiers_with_empty_values_are_removed (0.00s)
    --- PASS: TestNormalize/qualifiers_are_sorted_by_key (0.00s)
    --- PASS: TestNormalize/duplicate_keys_are_invalid (0.00s)
    --- PASS: TestNormalize/keys_are_made_lower_case (0.00s)
    --- PASS: TestNormalize/name_is_required (0.00s)
    --- PASS: TestNormalize/leading_and_traling_/_on_subpath_are_trimmed (0.00s)
    --- PASS: TestNormalize/'.'_is_an_invalid_subpath_segment (0.00s)
    --- PASS: TestNormalize/'..'_is_an_invalid_subpath_segment (0.00s)
    --- PASS: TestNormalize/'./'_is_a_valid_subpath_prefix (0.00s)
    --- PASS: TestNormalize/'../'_is_a_valid_subpath_prefix (0.00s)
    --- PASS: TestNormalize/known_type_namespace_adjustments (0.00s)
    --- PASS: TestNormalize/known_type_name_adjustments (0.00s)
    --- PASS: TestNormalize/known_type_version_adjustments (0.00s)
=== RUN   FuzzFromString
=== RUN   FuzzFromString/771e938e4458e983a736261a702e27c7a414fd660a15b63034f290b146d2f217
0=== RUN   FuzzFromString/d0a861fe9b7c443af2b649e08753442111b630dd29fcd570543db3f9351158aa
?A--- PASS: FuzzFromString (0.00s)
    --- PASS: FuzzFromString/771e938e4458e983a736261a702e27c7a414fd660a15b63034f290b146d2f217 (0.00s)
    --- PASS: FuzzFromString/d0a861fe9b7c443af2b649e08753442111b630dd29fcd570543db3f9351158aa (0.00s)
FAIL
coverage: 89.0% of statements
FAIL	github.com/package-url/packageurl-go	0.004s
FAIL
make: *** [Makefile:5: test] Error 1
@petergardfjall petergardfjall changed the title Unit tests are failing on master Missing handling of pkg:cpan causes tests to fail Feb 27, 2025
@petergardfjall
Copy link
Contributor Author

I opened #79 to address this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant