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

Implementation for range with multiple look buged when pre-release are not present #278

Closed
Stargateur opened this issue May 11, 2022 · 1 comment

Comments

@Stargateur
Copy link

Stargateur commented May 11, 2022

These tests look wrong

let ref r = req(">1.0.0-alpha, <1.0");
assert_match_none(r, &["1.0.0-beta"]);
let ref r = req(">1.0.0-alpha, <1");
assert_match_none(r, &["1.0.0-beta"]);

According to the comment:

semver/src/eval.rs

Lines 14 to 16 in 0080ed9

// If a version has a prerelease tag (for example, 1.2.3-alpha.3) then it
// will only be allowed to satisfy req if at least one comparator with the
// same major.minor.patch also has a prerelease tag.

That should match, It's very strange no ? Specially:,

let ref r = req(">=0.5.1-alpha3, <0.6");
assert_to_string(r, ">=0.5.1-alpha3, <0.6");
assert_match_all(
r,
&[
"0.5.1-alpha3",
"0.5.1-alpha4",
"0.5.1-beta",
"0.5.1",
"0.5.5",
],
);

Is as expected. And:

let ref r = req(">1.0.0-alpha, <1.0.0");
assert_match_all(r, &["1.0.0-beta"]);

Clearly show that 1.0.0-alpha < 1.0.0-beta < 1.0.0) Do I miss something ?

@dtolnay
Copy link
Owner

dtolnay commented May 11, 2022

This matches the proto-spec in semver/semver#584 and matches npm's semver implementation. The spec's treatment of <I.J is consistent with the behavior that I would want it to have.

@dtolnay dtolnay closed this as completed May 11, 2022
Repository owner locked and limited conversation to collaborators Jul 3, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants