-
Notifications
You must be signed in to change notification settings - Fork 525
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Handle framework identifiers comparison
FrameworkIdentifier instances were compared structurally before but it was problematic in some cases as '>= net45' matched 'sl40' that wasn't in the same framework. Fixes #1124
- Loading branch information
Showing
5 changed files
with
119 additions
and
17 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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 |
---|---|---|
@@ -1,19 +1,83 @@ | ||
module Packet.RestrictionApplicationSpecs | ||
module Paket.Requirements.RestrictionApplicationSpecs | ||
|
||
open System.IO | ||
open Paket | ||
open Paket.Domain | ||
open Chessie.ErrorHandling | ||
open FsUnit | ||
open NUnit.Framework | ||
open TestHelpers | ||
open Paket.Requirements | ||
|
||
let dotnet x = SinglePlatform(DotNetFramework(x)) | ||
|
||
module TestTargetProfiles = | ||
let DotNetFrameworkVersions = | ||
[FrameworkVersion.V1 | ||
FrameworkVersion.V1_1 | ||
FrameworkVersion.V2 | ||
FrameworkVersion.V3 | ||
FrameworkVersion.V3_5 | ||
FrameworkVersion.V4_Client | ||
FrameworkVersion.V4 | ||
FrameworkVersion.V4_5 | ||
FrameworkVersion.V4_5_1 | ||
FrameworkVersion.V4_5_2 | ||
FrameworkVersion.V4_5_3 | ||
FrameworkVersion.V4_6] | ||
|
||
let DotNetFrameworkProfiles = DotNetFrameworkVersions |> List.map dotnet | ||
|
||
let WindowsProfiles = | ||
[SinglePlatform(Windows "v4.5") | ||
SinglePlatform(Windows "v4.5.1")] | ||
|
||
let SilverlightProfiles = | ||
[SinglePlatform(Silverlight "v3.0") | ||
SinglePlatform(Silverlight "v4.0") | ||
SinglePlatform(Silverlight "v5.0")] | ||
|
||
let WindowsPhoneSilverlightProfiles = | ||
[SinglePlatform(WindowsPhoneSilverlight "v7.0") | ||
SinglePlatform(WindowsPhoneSilverlight "v7.1") | ||
SinglePlatform(WindowsPhoneSilverlight "v8.0") | ||
SinglePlatform(WindowsPhoneSilverlight "v8.1")] | ||
|
||
let AllProfiles = | ||
DotNetFrameworkProfiles @ | ||
WindowsProfiles @ | ||
SilverlightProfiles @ | ||
WindowsPhoneSilverlightProfiles @ | ||
[SinglePlatform(MonoAndroid) | ||
SinglePlatform(MonoTouch) | ||
SinglePlatform(XamariniOS) | ||
SinglePlatform(XamarinMac) | ||
SinglePlatform(WindowsPhoneApp "v8.1") | ||
] | ||
|
||
[<Test>] | ||
let ``>= net40 does not include silverlight (#1124)`` () = | ||
let ``>= net10 contains all but only dotnet versions (#1124)`` () = | ||
/// https://github.com/fsprojects/Paket/issues/1124 | ||
let restrictions = [FrameworkRestriction.AtLeast(DotNetFramework(FrameworkVersion.V4))] | ||
let targets = KnownTargetProfiles.DotNetFrameworkProfiles @ KnownTargetProfiles.SilverlightProfiles | ||
let restricted = applyRestrictionsToTargets restrictions targets | ||
let restrictions = [FrameworkRestriction.AtLeast(DotNetFramework(FrameworkVersion.V1))] | ||
let restricted = applyRestrictionsToTargets restrictions TestTargetProfiles.AllProfiles | ||
|
||
restricted |> shouldEqual TestTargetProfiles.DotNetFrameworkProfiles | ||
|
||
[<Test>] | ||
let ``>= net452 contains 4.5.2 and following versions`` () = | ||
let restrictions = [FrameworkRestriction.AtLeast(DotNetFramework(FrameworkVersion.V4_5_2))] | ||
let restricted = applyRestrictionsToTargets restrictions TestTargetProfiles.AllProfiles | ||
let expected = [FrameworkVersion.V4_5_2; FrameworkVersion.V4_5_3; FrameworkVersion.V4_6] |> List.map dotnet | ||
|
||
restricted |> shouldEqual expected | ||
|
||
[<Test>] | ||
let ``>= net40 < net451 contains 4.0 and 4.5`` () = | ||
let restrictions = [FrameworkRestriction.Between(DotNetFramework(FrameworkVersion.V4), DotNetFramework(FrameworkVersion.V4_5_1))] | ||
let restricted = applyRestrictionsToTargets restrictions TestTargetProfiles.AllProfiles | ||
let expected = [FrameworkVersion.V4; FrameworkVersion.V4_5] |> List.map dotnet | ||
|
||
restricted |> shouldEqual expected | ||
|
||
[<Test>] | ||
let ``>= sl30 contains all but only silverlight versions`` () = | ||
let restrictions = [FrameworkRestriction.AtLeast(Silverlight "v3.0")] | ||
let restricted = applyRestrictionsToTargets restrictions TestTargetProfiles.AllProfiles | ||
|
||
restricted |> shouldEqual KnownTargetProfiles.DotNetFrameworkProfiles | ||
restricted |> shouldEqual TestTargetProfiles.SilverlightProfiles |