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

Handle numeric part of preRelease identifiers correctly #426

Merged
merged 2 commits into from
Dec 5, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/Paket.Core/SemVer.fs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,12 @@ type SemVerInfo =

let pre =
match x.PreRelease with
| Some preRelease -> "-" + preRelease.Name + preReleaseBuild
| Some preRelease ->
let preReleaseNumber =
match preRelease.Number with
| Some number -> string number
| None -> ""
"-" + preRelease.Name + preReleaseNumber + preReleaseBuild
| None -> preReleaseBuild

sprintf "%d.%d.%d%s%s" x.Major x.Minor x.Patch build pre
Expand Down
1 change: 1 addition & 0 deletions tests/Paket.Tests/SemVerSpecs.fs
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ let ``can normalize versions``() =
(SemVer.Parse "1.2.3-alpha.3").Normalize() |> shouldEqual ((SemVer.Parse "1.2.3-alpha.3").ToString())
(SemVer.Parse "1.0.0-alpha").Normalize() |> shouldEqual ((SemVer.Parse "1.0.0-alpha").ToString())
(SemVer.Parse "1.0.0-alpha.1").Normalize() |> shouldEqual ((SemVer.Parse "1.0.0-alpha.1").ToString())
(SemVer.Parse "0.5.0-ci1411131947").Normalize() |> shouldEqual "0.5.0-ci1411131947"

[<Test>]
let ``can normalize build zeros``() =
Expand Down