-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b42dda7
commit 854cc09
Showing
4 changed files
with
171 additions
and
174 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 |
---|---|---|
@@ -1,47 +1,46 @@ | ||
using Actions.Commands; | ||
using Actions.Commands; | ||
using FluentAssertions; | ||
|
||
namespace Actions.Tests | ||
namespace Actions.Tests; | ||
|
||
public class VersioningCommandTest | ||
{ | ||
public class VersioningCommandTest | ||
[Theory] | ||
[InlineData("0.1.0", VersionIncrement.Major, "1.1.0")] | ||
[InlineData("0.1.0", VersionIncrement.Minor, "0.2.0")] | ||
[InlineData("0.1.0", VersionIncrement.Patch, "0.1.1")] | ||
public void VersionIncrementTest(string tag, VersionIncrement versionIncrement, string actual) | ||
{ | ||
[Theory] | ||
[InlineData("0.1.0", VersionIncrement.Major, "1.1.0")] | ||
[InlineData("0.1.0", VersionIncrement.Minor, "0.2.0")] | ||
[InlineData("0.1.0", VersionIncrement.Patch, "0.1.1")] | ||
public void VersionIncrementTest(string tag, VersionIncrement versionIncrement, string actual) | ||
{ | ||
var command = new VersioningCommand(tag, prefix: "", versionIncrement: versionIncrement, isPrelease: false, prerelease: ""); | ||
var versioning = command.Versioning(); | ||
var command = new VersioningCommand(tag, prefix: "", versionIncrement: versionIncrement, isPrelease: false, prerelease: ""); | ||
var versioning = command.Versioning(); | ||
|
||
versioning.Should().Be(actual); | ||
} | ||
versioning.Should().Be(actual); | ||
} | ||
|
||
[Theory] | ||
[InlineData("v0.1.0", "v", true, "0.1.1")] | ||
[InlineData("Ver0.1.0", "Ver", true, "0.1.1")] | ||
[InlineData("Ver.0.1.0", "Ver.", true, "0.1.1")] | ||
[InlineData("v0.1.0", "v", false, "v0.1.1")] | ||
[InlineData("Ver0.1.0", "Ver", false, "Ver0.1.1")] | ||
[InlineData("Ver.0.1.0", "Ver.", false, "Ver.0.1.1")] | ||
public void VersionPrefixTest(string tag, string prefix, bool withoutPrefix, string actual) | ||
{ | ||
var command = new VersioningCommand(tag, prefix: prefix, versionIncrement: VersionIncrement.Patch, isPrelease: false, prerelease: ""); | ||
var versioning = command.Versioning(withoutPrefix); | ||
[Theory] | ||
[InlineData("v0.1.0", "v", true, "0.1.1")] | ||
[InlineData("Ver0.1.0", "Ver", true, "0.1.1")] | ||
[InlineData("Ver.0.1.0", "Ver.", true, "0.1.1")] | ||
[InlineData("v0.1.0", "v", false, "v0.1.1")] | ||
[InlineData("Ver0.1.0", "Ver", false, "Ver0.1.1")] | ||
[InlineData("Ver.0.1.0", "Ver.", false, "Ver.0.1.1")] | ||
public void VersionPrefixTest(string tag, string prefix, bool withoutPrefix, string actual) | ||
{ | ||
var command = new VersioningCommand(tag, prefix: prefix, versionIncrement: VersionIncrement.Patch, isPrelease: false, prerelease: ""); | ||
var versioning = command.Versioning(withoutPrefix); | ||
|
||
versioning.Should().Be(actual); | ||
} | ||
versioning.Should().Be(actual); | ||
} | ||
|
||
[Theory] | ||
[InlineData("0.1.0", "", "0.1.1")] | ||
[InlineData("0.1.0", "alpha", "0.1.1-alpha")] | ||
[InlineData("0.1.0", "preview", "0.1.1-preview")] | ||
public void VersionPrereleaseTest(string tag, string prerelease, string actual) | ||
{ | ||
var command = new VersioningCommand(tag, prefix: "", versionIncrement: VersionIncrement.Patch, isPrelease: true, prerelease: prerelease); | ||
var versioning = command.Versioning(); | ||
[Theory] | ||
[InlineData("0.1.0", "", "0.1.1")] | ||
[InlineData("0.1.0", "alpha", "0.1.1-alpha")] | ||
[InlineData("0.1.0", "preview", "0.1.1-preview")] | ||
public void VersionPrereleaseTest(string tag, string prerelease, string actual) | ||
{ | ||
var command = new VersioningCommand(tag, prefix: "", versionIncrement: VersionIncrement.Patch, isPrelease: true, prerelease: prerelease); | ||
var versioning = command.Versioning(); | ||
|
||
versioning.Should().Be(actual); | ||
} | ||
versioning.Should().Be(actual); | ||
} | ||
} |
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 |
---|---|---|
@@ -1,58 +1,57 @@ | ||
namespace Actions.Commands | ||
namespace Actions.Commands; | ||
|
||
public class CreateDummyCommand | ||
{ | ||
public class CreateDummyCommand | ||
public void CreateDummyFiles(string basePath) | ||
{ | ||
public void CreateDummyFiles(string basePath) | ||
{ | ||
var upm = ("package.json", """ | ||
{ | ||
"name": "com.unity.plugin.example", | ||
"version": "1.2.310", | ||
"displayName": "Package Example Plugin", | ||
"description": "This is an example package", | ||
"unity": "2019.1", | ||
"unityRelease": "0b5", | ||
"dependencies": { | ||
"com.unity.example": "1.0.0" | ||
}, | ||
"keywords": [ | ||
"keyword1", | ||
"keyword2", | ||
"keyword3" | ||
], | ||
"author": { | ||
"name": "Unity", | ||
"email": "[email protected]", | ||
"url": "https://www.unity3d.com" | ||
} | ||
var upm = ("package.json", """ | ||
{ | ||
"name": "com.unity.plugin.example", | ||
"version": "1.2.310", | ||
"displayName": "Package Example Plugin", | ||
"description": "This is an example package", | ||
"unity": "2019.1", | ||
"unityRelease": "0b5", | ||
"dependencies": { | ||
"com.unity.example": "1.0.0" | ||
}, | ||
"keywords": [ | ||
"keyword1", | ||
"keyword2", | ||
"keyword3" | ||
], | ||
"author": { | ||
"name": "Unity", | ||
"email": "[email protected]", | ||
"url": "https://www.unity3d.com" | ||
} | ||
"""); | ||
var godot = ("plugin.cfg", """ | ||
[plugin] | ||
name="Sandbox.Godot" | ||
description="Sample." | ||
author="Cysharp" | ||
version="1.2.310" | ||
language="C-sharp" | ||
script="GodotPlugin.cs" | ||
"""); | ||
var directoryBuildProps = ("Directory.Build.props", """ | ||
<Project> | ||
<PropertyGroup> | ||
<VersionPrefix>1.2.310</VersionPrefix> | ||
</PropertyGroup> | ||
</Project> | ||
"""); | ||
} | ||
"""); | ||
var godot = ("plugin.cfg", """ | ||
[plugin] | ||
name="Sandbox.Godot" | ||
description="Sample." | ||
author="Cysharp" | ||
version="1.2.310" | ||
language="C-sharp" | ||
script="GodotPlugin.cs" | ||
"""); | ||
var directoryBuildProps = ("Directory.Build.props", """ | ||
<Project> | ||
<PropertyGroup> | ||
<VersionPrefix>1.2.310</VersionPrefix> | ||
</PropertyGroup> | ||
</Project> | ||
"""); | ||
|
||
foreach (var (file, contents) in new[] { upm, godot, directoryBuildProps }) | ||
{ | ||
var path = Path.Combine(basePath, file); | ||
if (!Directory.Exists(basePath)) | ||
Directory.CreateDirectory(basePath); | ||
foreach (var (file, contents) in new[] { upm, godot, directoryBuildProps }) | ||
{ | ||
var path = Path.Combine(basePath, file); | ||
if (!Directory.Exists(basePath)) | ||
Directory.CreateDirectory(basePath); | ||
|
||
Console.WriteLine($"- {path} ..."); | ||
File.WriteAllText(path, contents); | ||
} | ||
Console.WriteLine($"- {path} ..."); | ||
File.WriteAllText(path, contents); | ||
} | ||
} | ||
} |
Oops, something went wrong.