Skip to content

Commit

Permalink
Merge pull request #2523 from MecuSorin/release/next
Browse files Browse the repository at this point in the history
Fixed increments in SemVerInfo
  • Loading branch information
matthid authored Jun 27, 2020
2 parents 9b36420 + b14ab5f commit 3cf20c1
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/app/Fake.DotNet.NuGet/NuGetVersion.fs
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,17 @@ type NuGetVersionIncrement = SemVerInfo -> SemVerInfo
/// Increment patch version
let IncPatch:NuGetVersionIncrement =
fun (v:SemVerInfo) ->
{ v with Build=0I; Patch=(v.Patch+1u) }
{ v with Build=0I; Patch=(v.Patch+1u); Original = None }

/// Increment minor version
let IncMinor:NuGetVersionIncrement =
fun (v:SemVerInfo) ->
{ v with Build=0I; Patch=0u; Minor=(v.Minor+1u) }
{ v with Build=0I; Patch=0u; Minor=(v.Minor+1u); Original = None }

/// Increment major version
let IncMajor:NuGetVersionIncrement =
fun (v:SemVerInfo) ->
{ v with Build=0I; Patch=0u; Minor=0u; Major=(v.Major+1u) }
{ v with Build=0I; Patch=0u; Minor=0u; Major=(v.Major+1u); Original = None }

/// Arguments for the next NuGet version number computing
type NuGetVersionArg =
Expand Down
13 changes: 13 additions & 0 deletions src/test/Fake.Core.UnitTests/Fake.DotNet.NuGet.fs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ module Fake.DotNet.NuGetTests

open Fake.Core
open Fake.DotNet.NuGet
open Fake.DotNet.NuGet.Version
open Expecto

[<Tests>]
Expand Down Expand Up @@ -36,5 +37,17 @@ let tests =
let expected = "-ApiKey abc123 -DisableBuffering -NoSymbols -NoServiceEndpoint -Source MyNuGetSource -SymbolApiKey MySymbolApiKey -SymbolSource MySymbolSource -Timeout 360"

Expect.equal cli expected "Push args generated correctly."

test "Incrementing Patch for a SemVerInfo" {
Expect.equal (SemVer.parse("1.1.0") |> IncPatch |> string) "1.1.1" "Incremented Patch from 1.1.0 should be 1.1.1"
}

test "Incrementing Minor for a SemVerInfo" {
Expect.equal (SemVer.parse("1.1.1") |> IncMinor |> string) "1.2.0" "Incremented Minor from 1.1.1 should be 1.2.0"
}

test "Incrementing Major for a SemVerInfo" {
Expect.equal (SemVer.parse("1.1.1") |> IncMajor |> string) "2.0.0" "Incremented Patch from 1.1.1 should be 2.0.0"
}
]

0 comments on commit 3cf20c1

Please sign in to comment.