Files
Febe/tests/Febe.Tests/Desktop/Support/Repository.cs
T
Alby96andClaude Opus 5.5 2d40bfe35b
verifica / controlli (push) Canceled after 0s
verifica / prove (push) Canceled after 0s
verifica / installatore (push) Canceled after 0s
verifica / immagine (push) Canceled after 0s
Prove: senza docs/ (costruzione dell'immagine) le due prove che li leggono si saltano
Nell'esecuzione 449 la costruzione dell'immagine si è fermata su due prove:
InHouseAssetsTests (confronta la pila dei caratteri con docs/SPECIFICA.md) e
ScreenshotToolTests (elenca docs/schermate). Dentro l'immagine i sorgenti arrivano senza
docs/ (.dockerignore) e senza .git. Nuovo Repository.Docs, come GuideTests e
ImageContentsTests: rende la prova non conclusiva solo in quella copia; in un checkout la
prova va avanti e un percorso mancante la fa fallire. Provato togliendo docs/ e .git: le
due prove risultano ignorate; con docs/ passano.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-26 10:25:54 +01:00

50 lines
1.8 KiB
C#

namespace Febe.Tests.Desktop.Support;
/// <summary>Files of the repository the desktop tests look at (the committed icon, the build script of the installer).</summary>
internal static class Repository
{
/// <summary>The folder with Febe.slnx, found from the test binaries upward; null outside a checkout.</summary>
public static string? Root()
{
for (var folder = new DirectoryInfo(AppContext.BaseDirectory); folder is not null; folder = folder.Parent)
{
if (File.Exists(Path.Combine(folder.FullName, "Febe.slnx")))
{
return folder.FullName;
}
}
return null;
}
/// <summary>A file of the repository; the test is inconclusive when the checkout is not there.</summary>
public static string PathOf(params string[] parts)
{
var root = Root();
if (root is null)
{
Assert.Inconclusive("Il repository non è accanto alle prove.");
}
return Path.Combine([root, .. parts]);
}
/// <summary>
/// A file or folder under docs/. The build of the Docker image copies the sources without docs/ (.dockerignore) and
/// without .git: there the test is inconclusive. In a checkout docs/ is always there, so the test goes on and a
/// missing path fails it.
/// </summary>
public static string Docs(params string[] parts)
{
var path = PathOf(["docs", .. parts]);
var root = Root()!;
var isCheckout = Directory.Exists(Path.Combine(root, ".git")) || File.Exists(Path.Combine(root, ".git"));
if (!Directory.Exists(Path.Combine(root, "docs")) && !isCheckout)
{
Assert.Inconclusive("Questa copia del repository non ha docs/ (costruzione dell'immagine Docker).");
}
return path;
}
}