Skip to content

Commit

Permalink
Specifying prereleases did not work with pessimistic version constrai…
Browse files Browse the repository at this point in the history
…nt - fixes #1252
  • Loading branch information
forki committed Nov 24, 2015
1 parent bc0b6d5 commit c3dd55c
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 6 deletions.
3 changes: 3 additions & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#### 2.27.11 - 24.11.2015
* BUGFIX: Specifying prereleases did not work with pessimistic version constraint - https://github.com/fsprojects/Paket/issues/1252

#### 2.27.10 - 23.11.2015
* Create installer demo - https://github.com/fsprojects/Paket/issues/1251

Expand Down
2 changes: 1 addition & 1 deletion src/Paket.Core/VersionRange.fs
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ type VersionRequirement =
| VersionRangeBound.Including -> version >= from
| VersionRangeBound.Excluding -> version > from

isInLowerBound && isInUpperBound && checkPrerelease prerelease version
(isInLowerBound && isInUpperBound && checkPrerelease prerelease version) || sameVersionWithoutPreRelease from

member this.Range =
match this with
Expand Down
6 changes: 3 additions & 3 deletions tests/Paket.Tests/DependenciesFile/VersionRangeSpecs.fs
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ let ``can detect specific version``() =
[<Test>]
let ``can detect ordinary Between``() =
parseRange "~> 2.2" |> shouldEqual (VersionRange.Between("2.2","3.0"))
parseRange "~> 1.2" |> shouldEqual (VersionRange.Between("1.2","2.0"))
parseRange "~> 1.2" |> shouldEqual (VersionRange.Between("1.2","2.0"))
(VersionRequirement(parseRange "~> 1.0",PreReleaseStatus.All)).IsInRange(SemVer.Parse("1.0.071.9556")) |> shouldEqual true
(VersionRequirement(parseRange "~> 1.0",PreReleaseStatus.All)).IsInRange(SemVer.Parse("1.0.071.9432")) |> shouldEqual true

[<Test>]
let ``can detect lower versions for ~>``() =
parseRange "~> 3.2.0.0" |> shouldEqual (VersionRange.Between("3.2.0.0","3.2.1.0"))

parseRange "~> 1.2.3.4" |> shouldEqual (VersionRange.Between("1.2.3.4","1.2.4.0"))
parseRange "~> 1.2.3.4" |> shouldEqual (VersionRange.Between("1.2.3.4","1.2.4.0"))
parseRange "~> 1.2.3" |> shouldEqual (VersionRange.Between("1.2.3","1.3.0"))
parseRange "~> 1.2" |> shouldEqual (VersionRange.Between("1.2","2.0"))
parseRange "~> 1.0" |> shouldEqual (VersionRange.Between("1.0","2.0"))
Expand Down Expand Up @@ -80,7 +80,7 @@ let ``can detect prereleases``() =

[<Test>]
let ``can detect override operator``() =
parseRange "== 3.2.0.0" |> shouldEqual (VersionRange.OverrideAll(SemVer.Parse "3.2.0.0"))
parseRange "== 3.2.0.0" |> shouldEqual (VersionRange.OverrideAll(SemVer.Parse "3.2.0.0"))

[<Test>]
let ``can detect override operator for beta``() =
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module paket.dependenciesFile.VersionRequirementSpecs
module Paket.DependenciesFile.VersionRequirementSpecs

open Paket
open NUnit.Framework
Expand Down
5 changes: 5 additions & 0 deletions tests/Paket.Tests/FilterVersionSpecs.fs
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,11 @@ let ``can check if in range for 4-parts range``() =
"1.0.0.3108" |> isInRange (DependenciesFileParser.parseVersionRequirement "1.0.0.3108") |> shouldEqual true
"1.0.0.2420" |> isInRange (DependenciesFileParser.parseVersionRequirement "~> 1.0") |> shouldEqual true

[<Test>]
let ``does include prerelease when twiddle wakka``() =
"1.0.0-alpha002" |> isInRange (DependenciesFileParser.parseVersionRequirement "~> 1.0 alpha") |> shouldEqual true
"1.0" |> isInRange (DependenciesFileParser.parseVersionRequirement "~> 1.0 alpha") |> shouldEqual true

[<Test>]
let ``can support trailing 0``() =
"1.2.3" |> isInRange (DependenciesFileParser.parseVersionRequirement "1.2.3.0") |> shouldEqual true
Expand Down
2 changes: 1 addition & 1 deletion tests/Paket.Tests/UpdateProcessSpecs.fs
Original file line number Diff line number Diff line change
Expand Up @@ -734,7 +734,7 @@ let ``SelectiveUpdate updates package that conflicts with transitive dependency
let expected =
[("Ninject.Extensions.Interception","0.0.2-alpha001");
("Ninject.Extensions.Logging","0.0.3");
("Ninject", "0.0.3-alpha001")]
("Ninject", "0.0.2-alpha001")]
|> Seq.sortBy fst

result
Expand Down

0 comments on commit c3dd55c

Please sign in to comment.