mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-12-04 15:04:35 +00:00
Moved temporary files into a folder of their own below the data directory (#1245)
This commit is contained in:
1 parent
ddfc632b63
commit
12d3e1ec6c
52 files changed
+1219
-396
No files matched your search
@@ -0,0 +1,51 @@
|
||||
using System.ComponentModel;
|
||||
using System.Diagnostics;
|
||||
|
||||
using AIStudio.Tools;
|
||||
|
||||
namespace AIStudio.Tests.Tools;
|
||||
|
||||
/// <summary>
|
||||
/// Checks which failures to start Pandoc mean that it is not installed.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Most users have no Pandoc until they install it through AI Studio. The log notes that once, without a stack trace,
|
||||
/// and keeps errors with their stack traces for what nobody expects. The exception comes from a real Process.Start, since
|
||||
/// only it shows what each OS reports for a program which does not exist.
|
||||
/// </remarks>
|
||||
[TestFixture]
|
||||
public sealed class PandocMissingExecutableTests
|
||||
{
|
||||
[Test]
|
||||
public void AProgramWhichDoesNotExistCounts()
|
||||
{
|
||||
var startInfo = new ProcessStartInfo($"ai-studio-missing-program-{Guid.NewGuid():N}")
|
||||
{
|
||||
ArgumentList = { "--version" },
|
||||
UseShellExecute = false,
|
||||
RedirectStandardOutput = true,
|
||||
RedirectStandardError = true
|
||||
};
|
||||
|
||||
var failure = Assert.Catch(() => Process.Start(startInfo)?.Dispose());
|
||||
|
||||
Assert.That(Pandoc.IsMissingExecutable(failure!), Is.True, failure?.ToString());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void AProgramWhichCannotBeStartedDoesNotCount()
|
||||
{
|
||||
// Windows reports a denied access as ERROR_ACCESS_DENIED (5), macOS and Linux as EACCES (13):
|
||||
var failure = new Win32Exception(OperatingSystem.IsWindows() ? 5 : 13);
|
||||
|
||||
Assert.That(Pandoc.IsMissingExecutable(failure), Is.False);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void AnotherExceptionDoesNotCount()
|
||||
{
|
||||
var failure = new InvalidOperationException("No process is associated with this object.");
|
||||
|
||||
Assert.That(Pandoc.IsMissingExecutable(failure), Is.False);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user