-
Notifications
You must be signed in to change notification settings - Fork 1
test: additional semver coverage and error assertions #29
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
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
135 changes: 135 additions & 0 deletions
135
evaluation-cases/test-case-semver-invalid-comparand-categories.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,135 @@ | ||
| [ | ||
| { | ||
| "description": "A non-parseable SemVer comparand (\"not-a-version\") rejects the flag at parse time with a PARSE_ERROR rather than matching or coercing.", | ||
| "attributes": { | ||
| "app_version": "1.2.3" | ||
| }, | ||
| "defaultValue": "unknown", | ||
| "flag": "semver-invalid-comparand-syntax-test", | ||
| "result": { | ||
| "errorCode": "PARSE_ERROR", | ||
| "reason": "ERROR", | ||
| "value": "unknown" | ||
| }, | ||
| "targetingKey": "invalid-syntax", | ||
| "variationType": "STRING" | ||
| }, | ||
| { | ||
| "description": "A SemVer comparand with repeated hyphens inside its prerelease identifiers (\"1.2.3----R-S.12.9.1--.12+meta\") is valid and matches normally.", | ||
| "attributes": { | ||
| "app_version": "1.2.3----R-S.12.9.1--.12+meta" | ||
| }, | ||
| "defaultValue": "unknown", | ||
| "flag": "semver-valid-comparand-hyphenated-prerelease-test", | ||
| "result": { | ||
| "reason": "TARGETING_MATCH", | ||
| "value": "matched" | ||
| }, | ||
| "targetingKey": "valid-hyphenated-prerelease", | ||
| "variationType": "STRING" | ||
| }, | ||
| { | ||
| "description": "A SemVer comparand with consecutive dots in its prerelease identifiers (\"1.0.0-alpha..1\") rejects the flag at parse time with a PARSE_ERROR.", | ||
| "attributes": { | ||
| "app_version": "1.0.0-alpha.1" | ||
| }, | ||
| "defaultValue": "unknown", | ||
| "flag": "semver-invalid-comparand-consecutive-dots-test", | ||
| "result": { | ||
| "errorCode": "PARSE_ERROR", | ||
| "reason": "ERROR", | ||
| "value": "unknown" | ||
| }, | ||
| "targetingKey": "invalid-consecutive-dots", | ||
| "variationType": "STRING" | ||
| }, | ||
| { | ||
| "description": "A Ruby-style dot-suffixed SemVer comparand (\"1.2.3.DEV\") rejects the flag at parse time with a PARSE_ERROR.", | ||
| "attributes": { | ||
| "app_version": "1.2.3" | ||
| }, | ||
| "defaultValue": "unknown", | ||
| "flag": "semver-invalid-comparand-dot-suffix-test", | ||
| "result": { | ||
| "errorCode": "PARSE_ERROR", | ||
| "reason": "ERROR", | ||
| "value": "unknown" | ||
| }, | ||
| "targetingKey": "invalid-dot-suffix", | ||
| "variationType": "STRING" | ||
| }, | ||
| { | ||
| "description": "A short (two-component) SemVer comparand (\"1.2\") rejects the flag at parse time with a PARSE_ERROR.", | ||
| "attributes": { | ||
| "app_version": "1.2.3" | ||
| }, | ||
| "defaultValue": "unknown", | ||
| "flag": "semver-invalid-comparand-short-test", | ||
| "result": { | ||
| "errorCode": "PARSE_ERROR", | ||
| "reason": "ERROR", | ||
| "value": "unknown" | ||
| }, | ||
| "targetingKey": "invalid-short", | ||
| "variationType": "STRING" | ||
| }, | ||
| { | ||
| "description": "A v-prefixed SemVer comparand (\"v1.2.3\") rejects the flag at parse time with a PARSE_ERROR.", | ||
| "attributes": { | ||
| "app_version": "1.2.3" | ||
| }, | ||
| "defaultValue": "unknown", | ||
| "flag": "semver-invalid-comparand-vprefix-test", | ||
| "result": { | ||
| "errorCode": "PARSE_ERROR", | ||
| "reason": "ERROR", | ||
| "value": "unknown" | ||
| }, | ||
| "targetingKey": "invalid-vprefix", | ||
| "variationType": "STRING" | ||
| }, | ||
| { | ||
| "description": "A leading-zero core component in the SemVer comparand (\"01.2.3\") rejects the flag at parse time with a PARSE_ERROR.", | ||
| "attributes": { | ||
| "app_version": "1.2.3" | ||
| }, | ||
| "defaultValue": "unknown", | ||
| "flag": "semver-invalid-comparand-leading-zero-test", | ||
| "result": { | ||
| "errorCode": "PARSE_ERROR", | ||
| "reason": "ERROR", | ||
| "value": "unknown" | ||
| }, | ||
| "targetingKey": "invalid-leading-zero", | ||
| "variationType": "STRING" | ||
| }, | ||
| { | ||
| "description": "A non-string (JSON number) SemVer comparand rejects the flag at parse time with a PARSE_ERROR rather than coercing the number to a string.", | ||
| "attributes": { | ||
| "app_version": "1.2.3" | ||
| }, | ||
| "defaultValue": "unknown", | ||
| "flag": "semver-invalid-comparand-non-string-test", | ||
| "result": { | ||
| "errorCode": "PARSE_ERROR", | ||
| "reason": "ERROR", | ||
| "value": "unknown" | ||
| }, | ||
| "targetingKey": "invalid-non-string", | ||
| "variationType": "STRING" | ||
| }, | ||
| { | ||
| "description": "The rejected invalid-comparand flags must not poison the rest of the configuration: a neighboring valid SemVer flag still evaluates normally.", | ||
| "attributes": { | ||
| "app_version": "2.3.4" | ||
| }, | ||
| "defaultValue": "unknown", | ||
| "flag": "semver-comparison-test", | ||
| "result": { | ||
| "reason": "TARGETING_MATCH", | ||
| "value": "stable" | ||
| }, | ||
| "targetingKey": "after-invalid-categories", | ||
| "variationType": "STRING" | ||
| } | ||
| ] | ||
17 changes: 17 additions & 0 deletions
17
evaluation-cases/test-case-semver-invalid-comparand-waterfall.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| [ | ||
| { | ||
| "description": "An invalid configured SemVer comparand in a non-last allocation must reject the whole flag at parse time, even though a valid default allocation follows it in the waterfall. An implementation that skips the invalid allocation and falls through to the default would return \"fallback\" with a STATIC reason instead of an error.", | ||
| "attributes": { | ||
| "app_version": "1.2.3" | ||
| }, | ||
| "defaultValue": "unknown", | ||
| "flag": "semver-invalid-comparand-waterfall-test", | ||
| "result": { | ||
| "errorCode": "PARSE_ERROR", | ||
| "reason": "ERROR", | ||
| "value": "unknown" | ||
| }, | ||
| "targetingKey": "waterfall", | ||
| "variationType": "STRING" | ||
| } | ||
| ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,170 @@ | ||
| [ | ||
| { | ||
| "description": "Multi-digit numeric prerelease identifiers compare by numeric value, not lexicographically: 1.0.0-beta.2 must precede 1.0.0-beta.11. An implementation that string-compares identifiers would treat \"2\" as greater than \"11\" and fail to match.", | ||
| "attributes": { | ||
| "app_version": "10.0.0-beta.2" | ||
| }, | ||
| "defaultValue": "unknown", | ||
| "flag": "semver-precedence-test", | ||
| "result": { | ||
| "reason": "TARGETING_MATCH", | ||
| "value": "numeric-prerelease" | ||
| }, | ||
| "targetingKey": "numeric-prerelease", | ||
| "variationType": "STRING" | ||
| }, | ||
| { | ||
| "description": "Build metadata is ignored for equality: 1.0.0+linux and 1.0.0+darwin have equal precedence, so SEMVER_EQ matches.", | ||
| "attributes": { | ||
| "app_version": "20.0.0+linux" | ||
| }, | ||
| "defaultValue": "unknown", | ||
| "flag": "semver-precedence-test", | ||
| "result": { | ||
| "reason": "TARGETING_MATCH", | ||
| "value": "build-equal-precedence" | ||
| }, | ||
| "targetingKey": "build-equal-precedence", | ||
| "variationType": "STRING" | ||
| }, | ||
| { | ||
| "description": "Dotted/multi-segment build metadata is ignored for equality: 4.0.0+exp.sha.5114f85 equals 4.0.0.", | ||
| "attributes": { | ||
| "app_version": "30.0.0+exp.sha.5114f85" | ||
| }, | ||
| "defaultValue": "unknown", | ||
| "flag": "semver-precedence-test", | ||
| "result": { | ||
| "reason": "TARGETING_MATCH", | ||
| "value": "build-dotted-eq" | ||
| }, | ||
| "targetingKey": "build-dotted-eq", | ||
| "variationType": "STRING" | ||
| }, | ||
| { | ||
| "description": "Build metadata is ignored for SEMVER_LTE: 4.0.0+build.42 <= 4.0.0 is true (match).", | ||
| "attributes": { | ||
| "app_version": "40.0.0+build.42" | ||
| }, | ||
| "defaultValue": "unknown", | ||
| "flag": "semver-precedence-test", | ||
| "result": { | ||
| "reason": "TARGETING_MATCH", | ||
| "value": "build-lte" | ||
| }, | ||
| "targetingKey": "build-lte", | ||
| "variationType": "STRING" | ||
| }, | ||
| { | ||
| "description": "Build metadata is ignored for SEMVER_GTE: 4.0.0+build.42 >= 4.0.0 is true (match).", | ||
| "attributes": { | ||
| "app_version": "50.0.0+build.42" | ||
| }, | ||
| "defaultValue": "unknown", | ||
| "flag": "semver-precedence-test", | ||
| "result": { | ||
| "reason": "TARGETING_MATCH", | ||
| "value": "build-gte" | ||
| }, | ||
| "targetingKey": "build-gte", | ||
| "variationType": "STRING" | ||
| }, | ||
| { | ||
| "description": "Build metadata is ignored for SEMVER_NEQ: 4.0.0+build.42 != 4.0.0 is false (no match), so the evaluation falls through to the default.", | ||
| "attributes": { | ||
| "app_version": "60.0.0+build.42" | ||
| }, | ||
| "defaultValue": "unknown", | ||
| "flag": "semver-precedence-test", | ||
| "result": { | ||
| "reason": "DEFAULT", | ||
| "value": "unknown" | ||
| }, | ||
| "targetingKey": "build-neq", | ||
| "variationType": "STRING" | ||
| }, | ||
| { | ||
| "description": "Build metadata is ignored for SEMVER_LT: 4.0.0+build.42 < 4.0.0 is false (no match), so the evaluation falls through to the default.", | ||
| "attributes": { | ||
| "app_version": "70.0.0+build.42" | ||
| }, | ||
| "defaultValue": "unknown", | ||
| "flag": "semver-precedence-test", | ||
| "result": { | ||
| "reason": "DEFAULT", | ||
| "value": "unknown" | ||
| }, | ||
| "targetingKey": "build-lt", | ||
| "variationType": "STRING" | ||
| }, | ||
| { | ||
| "description": "Build metadata is ignored for SEMVER_GT: 4.0.0+build.42 > 4.0.0 is false (no match), so the evaluation falls through to the default.", | ||
| "attributes": { | ||
| "app_version": "80.0.0+build.42" | ||
| }, | ||
| "defaultValue": "unknown", | ||
| "flag": "semver-precedence-test", | ||
| "result": { | ||
| "reason": "DEFAULT", | ||
| "value": "unknown" | ||
| }, | ||
| "targetingKey": "build-gt", | ||
| "variationType": "STRING" | ||
| }, | ||
| { | ||
| "description": "Alphanumeric prerelease ordering: 1.0.0-alpha precedes 1.0.0-alpha.1 (fewer identifiers first), so SEMVER_LT matches.", | ||
| "attributes": { | ||
| "app_version": "90.0.0-alpha" | ||
| }, | ||
| "defaultValue": "unknown", | ||
| "flag": "semver-precedence-test", | ||
| "result": { | ||
| "reason": "TARGETING_MATCH", | ||
| "value": "alpha-before-alpha-1" | ||
| }, | ||
| "targetingKey": "alpha-before-alpha-1", | ||
| "variationType": "STRING" | ||
| }, | ||
| { | ||
| "description": "Alphanumeric prerelease ordering: numeric identifiers have lower precedence than alphanumeric (1.0.0-alpha.1 precedes 1.0.0-alpha.beta), so SEMVER_LT matches.", | ||
| "attributes": { | ||
| "app_version": "91.0.0-alpha.1" | ||
| }, | ||
| "defaultValue": "unknown", | ||
| "flag": "semver-precedence-test", | ||
| "result": { | ||
| "reason": "TARGETING_MATCH", | ||
| "value": "alpha-1-before-alpha-beta" | ||
| }, | ||
| "targetingKey": "alpha-1-before-alpha-beta", | ||
| "variationType": "STRING" | ||
| }, | ||
| { | ||
| "description": "Alphanumeric prerelease ordering: identifiers are compared lexicographically (1.0.0-alpha.beta precedes 1.0.0-beta), so SEMVER_LT matches.", | ||
| "attributes": { | ||
| "app_version": "92.0.0-alpha.beta" | ||
| }, | ||
| "defaultValue": "unknown", | ||
| "flag": "semver-precedence-test", | ||
| "result": { | ||
| "reason": "TARGETING_MATCH", | ||
| "value": "alpha-beta-before-beta" | ||
| }, | ||
| "targetingKey": "alpha-beta-before-beta", | ||
| "variationType": "STRING" | ||
| }, | ||
| { | ||
| "description": "Alphanumeric prerelease ordering: a prerelease version precedes the corresponding release (1.0.0-beta precedes 1.0.0), so SEMVER_LT matches.", | ||
| "attributes": { | ||
| "app_version": "93.0.0-beta" | ||
| }, | ||
| "defaultValue": "unknown", | ||
| "flag": "semver-precedence-test", | ||
| "result": { | ||
| "reason": "TARGETING_MATCH", | ||
| "value": "beta-before-release" | ||
| }, | ||
| "targetingKey": "beta-before-release", | ||
| "variationType": "STRING" | ||
| } | ||
| ] |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.