Skip to content

Commit

Permalink
Add ParserSpecs for redirects
Browse files Browse the repository at this point in the history
  • Loading branch information
forki committed Sep 17, 2015
1 parent aca6d7a commit 6078c7d
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/Paket.Core/InstallProcess.fs
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ let InstallIntoProjects(options : InstallerOptions, dependenciesFile, lockFile :
| _ -> options.Redirects || g.Value.Options.Redirects

isEnabled && (fst kv.Key) = g.Key)
|> Seq.map (fun kv -> kv.Value)
|> Seq.map (fun kv -> kv.Value)
|> applyBindingRedirects options.CreateNewBindingFiles root

/// Installs all packages from the lock file.
Expand Down
4 changes: 3 additions & 1 deletion tests/Paket.Tests/DependenciesFile/ParserSpecs.fs
Original file line number Diff line number Diff line change
Expand Up @@ -752,7 +752,7 @@ nuget FsReveal
group Build
nuget FAKE
nuget FAKE redirects: on
nuget NUnit condition: legacy
"""

Expand All @@ -763,4 +763,6 @@ let ``should read config with reference condition``() =
cfg.Groups.[Constants.MainDependencyGroup].Options.Settings.ReferenceCondition |> shouldEqual (Some "MAIN-GROUP")

cfg.Groups.[GroupName "Build"].Packages.Head.Settings.ReferenceCondition |> shouldEqual None
cfg.Groups.[GroupName "Build"].Packages.Head.Settings.CreateBindingRedirects |> shouldEqual (Some true)
cfg.Groups.[GroupName "Build"].Packages.Tail.Head.Settings.ReferenceCondition |> shouldEqual (Some "LEGACY")
cfg.Groups.[GroupName "Build"].Packages.Tail.Head.Settings.CreateBindingRedirects |> shouldEqual None
5 changes: 3 additions & 2 deletions tests/Paket.Tests/Lockfile/ParserSpecs.fs
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,7 @@ CONDITION: LEGACY
NUGET
remote: "D:\code\temp with space"
specs:
FAKE (4.0)
FAKE (4.0) - redirects: on
"""

[<Test>]
Expand Down Expand Up @@ -523,4 +523,5 @@ let ``should parse lock file with groups``() =
lockFile2.Options.Settings.ReferenceCondition |> shouldEqual (Some "LEGACY")

packages2.Head.Source |> shouldEqual (PackageSource.LocalNuget("D:\code\\temp with space"))
packages2.[0].Name |> shouldEqual (PackageName "FAKE")
packages2.[0].Name |> shouldEqual (PackageName "FAKE")
packages2.[0].Settings.CreateBindingRedirects |> shouldEqual (Some true)
21 changes: 20 additions & 1 deletion tests/Paket.Tests/ReferencesFile/ReferencesFileSpecs.fs
Original file line number Diff line number Diff line change
Expand Up @@ -352,4 +352,23 @@ let ``should parse reffiles with reference condition``() =
mainGroup.NugetPackages.Head.Name |> shouldEqual (PackageName "Castle.Windsor")
mainGroup.NugetPackages.Head.Settings.ReferenceCondition |> shouldEqual None
mainGroup.NugetPackages.Tail.Head.Name |> shouldEqual (PackageName "Newtonsoft.Json")
mainGroup.NugetPackages.Tail.Head.Settings.ReferenceCondition |> shouldEqual (Some "LEGACY")
mainGroup.NugetPackages.Tail.Head.Settings.ReferenceCondition |> shouldEqual (Some "LEGACY")


let refFileWithRedirects = """
Castle.Windsor
Newtonsoft.Json redirects:on
FSharp.Core redirects:off
"""

[<Test>]
let ``should parse reffiles with redirects``() =
let refFile = ReferencesFile.FromLines(toLines refFileWithRedirects)
let mainGroup = refFile.Groups.[Constants.MainDependencyGroup]
mainGroup.NugetPackages.Length |> shouldEqual 3
mainGroup.NugetPackages.Head.Name |> shouldEqual (PackageName "Castle.Windsor")
mainGroup.NugetPackages.Head.Settings.CreateBindingRedirects |> shouldEqual None
mainGroup.NugetPackages.Tail.Head.Name |> shouldEqual (PackageName "Newtonsoft.Json")
mainGroup.NugetPackages.Tail.Head.Settings.CreateBindingRedirects |> shouldEqual (Some true)
mainGroup.NugetPackages.Tail.Tail.Head.Name |> shouldEqual (PackageName "FSharp.Core")
mainGroup.NugetPackages.Tail.Tail.Head.Settings.CreateBindingRedirects |> shouldEqual (Some false)

0 comments on commit 6078c7d

Please sign in to comment.