-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WIP
- Loading branch information
Showing
14 changed files
with
286 additions
and
103 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
//////////////////////////////////////////////////////////////////////////////////////// | ||
// | ||
// RelaxVersioner - Git tag/branch based, full-automatic version information inserter. | ||
// Copyright (c) Kouji Matsui (@kozy_kekyo, @kekyo@mastodon.cloud) | ||
// | ||
// Licensed under Apache-v2: https://opensource.org/licenses/Apache-2.0 | ||
// | ||
//////////////////////////////////////////////////////////////////////////////////////// | ||
|
||
using GitReader; | ||
using GitReader.Structures; | ||
using NUnit.Framework; | ||
using System.IO; | ||
using System.Threading.Tasks; | ||
|
||
namespace RelaxVersioner; | ||
|
||
public sealed class AnalyzerTests | ||
{ | ||
[TestCase("NothingAnyTags1", "0.0.4")] | ||
[TestCase("TagInPrimary", "0.10.1")] | ||
[TestCase("TagInSecondary", "0.20.1")] | ||
public async Task LookupVersionLabel(string repositoryName, string expectedString) | ||
{ | ||
using var repository = await Repository.Factory.OpenStructureAsync( | ||
Path.Combine(TestsSetUp.BasePath, repositoryName)); | ||
|
||
var actual = await Analyzer.LookupVersionLabelAsync(repository.Head!, default); | ||
|
||
Assert.AreEqual(expectedString, actual.ToString()); | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
CenterCLR.RelaxVersioner.Core.Tests/CenterCLR.RelaxVersioner.Core.Tests.csproj
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,30 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<Nullable>enable</Nullable> | ||
<TargetFrameworks>net48;net5.0;net6.0;net7.0</TargetFrameworks> | ||
<NoWarn>$(NoWarn);NU5104</NoWarn> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.5.0" /> | ||
<PackageReference Include="NUnit" Version="3.13.3" /> | ||
<PackageReference Include="NUnit3TestAdapter" Version="4.4.2" /> | ||
<PackageReference Include="Verify.NUnit" Version="19.13.0" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\CenterCLR.RelaxVersioner.Core\CenterCLR.RelaxVersioner.Core.csproj" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<Folder Include="artifacts\" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<None Update="artifacts\*.zip"> | ||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | ||
</None> | ||
</ItemGroup> | ||
|
||
</Project> |
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,46 @@ | ||
//////////////////////////////////////////////////////////////////////////////////////// | ||
// | ||
// RelaxVersioner - Git tag/branch based, full-automatic version information inserter. | ||
// Copyright (c) Kouji Matsui (@kozy_kekyo, @kekyo@mastodon.cloud) | ||
// | ||
// Licensed under Apache-v2: https://opensource.org/licenses/Apache-2.0 | ||
// | ||
//////////////////////////////////////////////////////////////////////////////////////// | ||
|
||
using System; | ||
using System.IO; | ||
using System.IO.Compression; | ||
using VerifyTests; | ||
|
||
namespace RelaxVersioner; | ||
|
||
public sealed class TestsSetUp | ||
{ | ||
public static readonly string BasePath = | ||
Path.Combine("tests", $"{DateTime.Now:yyyyMMdd_HHmmss}"); | ||
|
||
static TestsSetUp() | ||
{ | ||
VerifierSettings.DontScrubDateTimes(); | ||
|
||
if (!Directory.Exists(BasePath)) | ||
{ | ||
foreach (var path in Directory.EnumerateFiles( | ||
"artifacts", "*.zip", SearchOption.AllDirectories)) | ||
{ | ||
var fileName = Path.GetFileNameWithoutExtension(path); | ||
var targetBasePath = Path.Combine(BasePath, fileName); | ||
|
||
try | ||
{ | ||
Directory.CreateDirectory(targetBasePath); | ||
} | ||
catch | ||
{ | ||
} | ||
|
||
ZipFile.ExtractToDirectory(path, targetBasePath); | ||
} | ||
} | ||
} | ||
} |
Binary file not shown.
Binary file not shown.
Binary file not shown.
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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
//////////////////////////////////////////////////////////////////////////////////////// | ||
// | ||
// RelaxVersioner - Git tag/branch based, full-automatic version information inserter. | ||
// Copyright (c) Kouji Matsui (@kozy_kekyo, @kekyo@mastodon.cloud) | ||
// | ||
// Licensed under Apache-v2: https://opensource.org/licenses/Apache-2.0 | ||
// | ||
//////////////////////////////////////////////////////////////////////////////////////// | ||
|
||
using System.Runtime.CompilerServices; | ||
|
||
[assembly: InternalsVisibleTo("CenterCLR.RelaxVersioner.Core.Tests")] |
Oops, something went wrong.