Merge branch 'fix/setup-bundle': .titano project files, per-machine server, services and Run entries handled by setup, per-product data removal
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC
This commit is contained in:
49 files changed
+2741
-128
No files matched your search
@@ -0,0 +1,33 @@
|
||||
using Titano.Testing;
|
||||
using Titano.Tools.Commands;
|
||||
|
||||
namespace Titano.Tools.Tests;
|
||||
|
||||
/// <summary>Release notes from Conventional Commits (BRIEF §19.3), as release.yml renders them with a title.</summary>
|
||||
public sealed class ChangelogCommandTests
|
||||
{
|
||||
[Test]
|
||||
public void EntriesAreGroupedByTypeUnderTheTitle()
|
||||
{
|
||||
var notes = ChangelogCommand.Render(["abc1234\tfeat(editor): save the project as a .titano file", "def5678\tfix: keep user data", "0a1b2c3\tchore: bump"], "Titano 1.2.0");
|
||||
Assert.Equal(
|
||||
"# Titano 1.2.0\n\n### Added\n- **editor**: save the project as a .titano file (abc1234)\n\n### Fixed\n- keep user data (def5678)\n\n",
|
||||
notes.ReplaceLineEndings("\n"));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ATitledReleaseWithoutListedChangesSaysItIsAMaintenanceRelease()
|
||||
{
|
||||
string[] lines = ["abc1234\tchore: bump", "def5678\tci: cache", "0a1b2c3\ttest(setup): cover uninstall", "not a conventional subject"];
|
||||
Assert.Equal("# Titano 1.2.1\n\nMaintenance release.\n", ChangelogCommand.Render(lines, "Titano 1.2.1").ReplaceLineEndings("\n"));
|
||||
Assert.Equal("Maintenance release.\n", ChangelogCommand.Render(lines, null).ReplaceLineEndings("\n"));
|
||||
Assert.Equal("Maintenance release.\n", ChangelogCommand.Render([], null).ReplaceLineEndings("\n"));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ABreakingChangeOfAnUnlistedTypeIsStillWritten()
|
||||
{
|
||||
var notes = ChangelogCommand.Render(["abc1234\trefactor(core)!: rename the archive layout"], "Titano 2.0.0").ReplaceLineEndings("\n");
|
||||
Assert.Equal("# Titano 2.0.0\n\n### Breaking changes\n- **core**: rename the archive layout (abc1234)\n\n", notes);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
using Titano.Core.Packaging;
|
||||
using Titano.Testing;
|
||||
using Titano.Tools.Commands;
|
||||
|
||||
namespace Titano.Tools.Tests;
|
||||
|
||||
/// <summary>pack-installer writes the components, shortcuts and file types setup installs (BRIEF §18).</summary>
|
||||
public sealed class PackInstallerCommandTests(TestContext context)
|
||||
{
|
||||
[Test]
|
||||
public async Task TheServerInstallsOnlyForAllUsersAndTitanoOwnsTheProjectFileType()
|
||||
{
|
||||
var root = context.CreateTempDirectory("pack");
|
||||
var stub = Path.Combine(root, "Titano.Setup.exe");
|
||||
var bytes = new byte[4096];
|
||||
new Random(5).NextBytes(bytes);
|
||||
"MZ"u8.CopyTo(bytes);
|
||||
await File.WriteAllBytesAsync(stub, bytes);
|
||||
var app = Program(root, "app", "Titano.exe");
|
||||
var server = Program(root, "server", "Titano.Server.exe");
|
||||
var output = Path.Combine(root, "out", "Titano-Setup.exe");
|
||||
|
||||
Assert.Equal(0, await new PackInstallerCommand().RunAsync(
|
||||
["--setup", stub, "--product", "Titano", "--version", "1.2.3", "--component", "Titano=" + app, "--component", "Server=" + server, "--out", output]));
|
||||
|
||||
using var reader = PayloadReader.Open(output);
|
||||
var manifest = reader.Manifest;
|
||||
Assert.False(manifest.FindComponent("Titano")!.AllUsersOnly);
|
||||
var serverComponent = manifest.FindComponent("Server")!;
|
||||
Assert.True(serverComponent.AllUsersOnly);
|
||||
Assert.False(serverComponent.DefaultSelected);
|
||||
var association = Assert.Contains(manifest.Associations, a => a.Extension == ".titano");
|
||||
Assert.Equal("Titano.Project", association.ProgId);
|
||||
Assert.Equal("Titano.exe", association.Target);
|
||||
Assert.Equal("Titano", association.Component);
|
||||
}
|
||||
|
||||
private static string Program(string root, string folder, string name)
|
||||
{
|
||||
var dir = Directory.CreateDirectory(Path.Combine(root, folder)).FullName;
|
||||
File.WriteAllText(Path.Combine(dir, name), "MZ " + name);
|
||||
return dir;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user