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

Fixed increments in SemVerInfo #2523

Merged
merged 1 commit into from
Jun 27, 2020
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
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"
}
]