-
-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
replace default pre-release phase with default pre-release identifiers
- Loading branch information
Showing
18 changed files
with
193 additions
and
96 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
using System.Collections.Generic; | ||
|
||
namespace MinVer.Lib; | ||
|
||
public static class PreReleaseIdentifiers | ||
{ | ||
public static readonly IReadOnlyCollection<string> Default = new List<string> { "alpha", "0", }; | ||
} |
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
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
63 changes: 63 additions & 0 deletions
63
MinVerTests.Packages/CustomDefaultPreReleaseIdentifiers.cs
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 |
---|---|---|
@@ -0,0 +1,63 @@ | ||
using System; | ||
using System.Reflection; | ||
using System.Threading.Tasks; | ||
using MinVerTests.Infra; | ||
using Xunit; | ||
|
||
namespace MinVerTests.Packages; | ||
|
||
public static class CustomDefaultPreReleaseIdentifiers | ||
{ | ||
[Fact] | ||
public static async Task HasCustomDefaultPreReleaseIdentifiers() | ||
{ | ||
// arrange | ||
var path = MethodBase.GetCurrentMethod().GetTestDirectory(); | ||
await Sdk.CreateProject(path); | ||
|
||
await Git.Init(path); | ||
await Git.Commit(path); | ||
await Git.Tag(path, "2.3.4"); | ||
await Git.Commit(path); | ||
|
||
var envVars = ("MinVerDefaultPreReleaseIdentifiers".ToAltCase(), "preview.0"); | ||
|
||
var expected = Package.WithVersion(2, 3, 5, new[] { "preview", "0", }, 1); | ||
|
||
// act | ||
var (actual, _, _) = await Sdk.BuildProject(path, envVars: envVars); | ||
var (cliStandardOutput, _) = await MinVerCli.ReadAsync(path, envVars: envVars); | ||
|
||
// assert | ||
Assert.Equal(expected, actual); | ||
Assert.Equal(expected.Version, cliStandardOutput.Trim()); | ||
} | ||
|
||
[Fact] | ||
public static async Task HasCustomDefaultPreReleasePhase() | ||
{ | ||
// arrange | ||
var path = MethodBase.GetCurrentMethod().GetTestDirectory(); | ||
await Sdk.CreateProject(path); | ||
|
||
await Git.Init(path); | ||
await Git.Commit(path); | ||
await Git.Tag(path, "2.3.4"); | ||
await Git.Commit(path); | ||
|
||
var envVars = ("MinVerDefaultPreReleasePhase".ToAltCase(), "preview"); | ||
|
||
var expected = Package.WithVersion(2, 3, 5, new[] { "preview", "0", }, 1); | ||
|
||
// act | ||
var (actual, sdkStandardOutput, _) = await Sdk.BuildProject(path, envVars: envVars); | ||
var (cliStandardOutput, cliStandardError) = await MinVerCli.ReadAsync(path, envVars: envVars); | ||
|
||
// assert | ||
Assert.Equal(expected, actual); | ||
Assert.Contains("MINVER1008", sdkStandardOutput, StringComparison.Ordinal); | ||
|
||
Assert.Equal(expected.Version, cliStandardOutput.Trim()); | ||
Assert.Contains("MinVerDefaultPreReleasePhase is deprecated", cliStandardError, StringComparison.Ordinal); | ||
} | ||
} |
Oops, something went wrong.