-
Notifications
You must be signed in to change notification settings - Fork 213
Rewrite 2 of tests.md #752
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
base: main
Are you sure you want to change the base?
Changes from 4 commits
9f89ff8
e16df42
0dd0d1c
ec48636
d200192
cd63ebb
2834d14
ce5b140
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1,27 +1,242 @@ | ||||||
| ## Tests | ||||||
|
|
||||||
| To support the language-neutral testing of `purl` implementations, a test | ||||||
| suite is provided as JSON document named `test-suite-data.json`. This JSON | ||||||
| document contains an array of objects. Each object represents a test with | ||||||
| these key/value pairs some of which may not be normalized: | ||||||
|
|
||||||
| - **purl**: a `purl` string. | ||||||
| - **canonical**: the same `purl` string in canonical, normalized form | ||||||
| - **type**: the `type` corresponding to this `purl`. | ||||||
| - **namespace**: the `namespace` corresponding to this `purl`. | ||||||
| - **name**: the `name` corresponding to this `purl`. | ||||||
| - **version**: the `version` corresponding to this `purl`. | ||||||
| - **qualifiers**: the `qualifiers` corresponding to this `purl` as an object | ||||||
| of {key: value} qualifier pairs. | ||||||
| - **subpath**: the `subpath` corresponding to this `purl`. | ||||||
| - **is_invalid**: a boolean flag set to true if the test should report an | ||||||
| error | ||||||
|
|
||||||
| To test `purl` parsing and building, a tool can use this test suite and for | ||||||
| every listed test object, run these tests: | ||||||
|
|
||||||
| - parsing the test canonical `purl` then re-building a `purl` from these | ||||||
| parsed components should return the test canonical `purl` | ||||||
| >This is a draft document to replace the current tests.md file. The scope of | ||||||
| tests.md is to provide an overall description of PURL tests in the context of | ||||||
| the PURL test schema. Its scope does not cover how to create a test file or | ||||||
| how to use the test files for a PURL tool. | ||||||
|
|
||||||
| >The primary text is a provisional draft based on the existing v0.1 schema and recent proposed changes. There are Discussion sections to track key notes and | ||||||
| questions separately from the current draft text. | ||||||
|
|
||||||
| >Note that this document uses Ecma standard style conventions for consistency | ||||||
| with the PURL specification language in the PURL 1st edition standard, e.g., | ||||||
| bolding key words instead of using code snippet notation (back-ticks). | ||||||
|
|
||||||
| The Package-URL (PURL) specification provides a JSON Schema and test | ||||||
| files to support language-neutral testing of PURL implementations. The | ||||||
| objectives for the PURL schema and test files are to enable tools to conform | ||||||
mjherzog marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||
| to the PURL specification for tool functions such as: | ||||||
mjherzog marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||
| - build a canonical PURL string from a set of PURL components | ||||||
| - parse a PURL string into a set of PURL components | ||||||
| - validate a PURL string and provide messages about the correctness of | ||||||
| the input PURL | ||||||
| - analyze a PURL string and correct errors to produce a canonical PURL | ||||||
mjherzog marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||
|
|
||||||
| The current JSON schema is available at: [`purl-spec/schemas/purl-test.schema-0.1.json`](https://github.com/package-url/purl-spec/blob/main/schemas/purl-type-definition.schema-1.0.json). | ||||||
mjherzog marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||
|
|
||||||
| The test files are available at: | ||||||
| - [`purl-spec/tests/spec/`](https://github.com/package-url/purl-spec/tree/main/tests/spec): This folder contains JSON test files that are not for a specific PURL type. | ||||||
| - [`specification-test.json`](https://github.com/package-url/purl-spec/blob/main/tests/spec/specification-test.json) - This file contains an array of test | ||||||
| cases that primarily cover testing the validity of individual PURL | ||||||
| components or separators between a pair of PURL components. | ||||||
| - *component-test.json*: These are test files for a specific PURL component. | ||||||
| See [PR 738](https://github.com/package-url/purl-spec/pull/738) which adds | ||||||
| `tests/spec/qualifiers.json`. | ||||||
| - [`purl-spec/tests/types/`](https://github.com/package-url/purl-spec/tree/main/tests/types): This folder contains one JSON test file for each | ||||||
| registered PURL type. These tests should be focused on test cases that are | ||||||
| specific to a PURL type, such as those for namespace or qualifiers. | ||||||
|
|
||||||
| Any PURL implementation tool is expected to canonicalize a PURL string or | ||||||
mjherzog marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||
| PURL components during a parsing or building operation. | ||||||
|
||||||
| PURL components during a parsing or building operation. | |
| properly decode PURL components during a building operation. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a tall order... it is OK to have some overlap here, it does not hurt.
mjherzog marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
mjherzog marked this conversation as resolved.
Show resolved
Hide resolved
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not always.
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same, not always.
mjherzog marked this conversation as resolved.
Show resolved
Hide resolved
mjherzog marked this conversation as resolved.
Show resolved
Hide resolved
mjherzog marked this conversation as resolved.
Show resolved
Hide resolved
mjherzog marked this conversation as resolved.
Show resolved
Hide resolved
mjherzog marked this conversation as resolved.
Show resolved
Hide resolved
mjherzog marked this conversation as resolved.
Show resolved
Hide resolved
mjherzog marked this conversation as resolved.
Show resolved
Hide resolved
mjherzog marked this conversation as resolved.
Show resolved
Hide resolved
mjherzog marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense.
mjherzog marked this conversation as resolved.
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, but then we should at least link to existing implementations
mjherzog marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
100% agree
Uh oh!
There was an error while loading. Please reload this page.