-
Notifications
You must be signed in to change notification settings - Fork 585
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
Semver parse fix to handle prereleases and build parts #1325
Changes from 4 commits
e881cb0
cbc4ce2
1072131
799b4be
5fa152c
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 |
---|---|---|
|
@@ -60,13 +60,13 @@ public class when_validating_semver_strings | |
public class when_parsing_semver_strings | ||
{ | ||
static SemVerHelper.SemVerInfo semVer; | ||
Because of = () => semVer = SemVerHelper.parse("1.2.3-alpha.beta"); | ||
Because of = () => semVer = SemVerHelper.parse("1.2.3-alpha+beta"); | ||
|
||
It should_parse_major = () => semVer.Major.ShouldEqual(1); | ||
It should_parse_minor = () => semVer.Minor.ShouldEqual(2); | ||
It should_parse_patch = () => semVer.Patch.ShouldEqual(3); | ||
It should_parse_prerelease = () => semVer.PreRelease.ShouldEqual( | ||
FSharpOption<SemVerHelper.PreRelease>.Some(new SemVerHelper.PreRelease("alpha", "alpha", FSharpOption<int>.None))); | ||
FSharpOption<SemVerHelper.PreRelease>.Some(new SemVerHelper.PreRelease("alpha", "alpha", FSharpOption<int>.None, new[] { SemVerHelper.Ident.NewAlphaNumeric("alpha") }.ToFSharpList()))); | ||
It should_parse_build = () => semVer.Build.ShouldEqual("beta"); | ||
} | ||
|
||
|
@@ -96,9 +96,9 @@ public class when_comparing_semvers | |
() => SemVerHelper.parse("1.0.0-alpha.1") | ||
.ShouldBeLessThan(SemVerHelper.parse("1.0.0-alpha.beta")); | ||
|
||
It should_assume_alpha_is_smaller_tha_beta = | ||
It should_assume_that_longer_prereleases_are_greater = | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it's better to keep the old tests as well There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I kept the test data, but per the spec for these inputs 1.0.0-beta is larger, because a shorter prerelease tag is bigger than a longer prerelease tag. |
||
() => SemVerHelper.parse("1.0.0-alpha.beta") | ||
.ShouldBeLessThan(SemVerHelper.parse("1.0.0-beta")); | ||
.ShouldBeGreaterThan(SemVerHelper.parse("1.0.0-beta")); | ||
|
||
It should_assume_empty_build_no_in_beta_build_is_smaller_than_text_in_build = | ||
() => SemVerHelper.parse("1.0.0-beta") | ||
|
@@ -128,9 +128,9 @@ public class when_comparing_semvers | |
() => SemVerHelper.parse("2.3.4-alpha2") | ||
.ShouldBeGreaterThan(SemVerHelper.parse("2.3.4-alpha")); | ||
|
||
It should_assume_alpha003_is_greater_than_alpha2 = | ||
It should_assume_alpha003_is_less_than_alpha2_because_lexicalsort = | ||
() => SemVerHelper.parse("2.3.4-alpha003") | ||
.ShouldBeGreaterThan(SemVerHelper.parse("2.3.4-alpha2")); | ||
.ShouldBeLessThan(SemVerHelper.parse("2.3.4-alpha2")); | ||
|
||
It should_assume_rc_is_greater_than_beta2 = | ||
() => SemVerHelper.parse("2.3.4-rc") | ||
|
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.
why this change?
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.
I made this change because the comparison logic in the spec changed. rc007 is now less than rc2, so the expected output for the given release notes data had to change to take the improved comparison rules into account.
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.
Oh that's breaking in fake. Not sure if we really want that.
On Jul 24, 2016 6:56 PM, "Chester Husk III" [email protected]
wrote:
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.
Current logic is wrong, though. Part of the reason I chafed working with nuget was because they implemented almost-sorta-but-not-really-semver, so none of the existing libraries worked. Do we want to do the same? Besides, if people depend on that sorting, they can either
rc.{increment}
, where increment is a number and thus compared numerically, orrc{padding}{number}
, and be consistent, sorc007
compared torc002
,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.
The problem is usually the existing packages. But maybe this is less of a
problem now. It was a huge problem couple of years ago before we starter
with paket
On Jul 24, 2016 7:01 PM, "Chester Husk III" [email protected]
wrote: