mirror of
https://github.com/space-wizards/RobustToolbox.git
synced 2026-02-15 03:30:53 +01:00
Robust.UnitTesting was both ALL tests for RT, and also API surface for content tests. Tests are now split into separate projects as appropriate, and the API side has also been split off.
42 lines
981 B
C#
42 lines
981 B
C#
using System.Threading.Tasks;
|
|
using NUnit.Framework;
|
|
using Robust.Shared.GameObjects;
|
|
using Robust.Shared.Toolshed.Errors;
|
|
|
|
namespace Robust.UnitTesting.Shared.Toolshed;
|
|
|
|
[TestFixture]
|
|
internal sealed class ErrorHandlingTest : ToolshedTest
|
|
{
|
|
[Test]
|
|
public async Task ExceptionsAreErrors()
|
|
{
|
|
await Server.WaitAssertion(() =>
|
|
{
|
|
ExpectError<UnhandledExceptionError>();
|
|
InvokeCommand("fuck", out _);
|
|
});
|
|
}
|
|
|
|
[Test]
|
|
public async Task NoDivideByZeroError()
|
|
{
|
|
// This shouldn't throw, because toolshed is nice :)
|
|
await Server.WaitAssertion(() =>
|
|
{
|
|
InvokeCommand<float>("f 1 / 0");
|
|
InvokeCommand<int>("i 1 / 0");
|
|
});
|
|
}
|
|
|
|
[Test]
|
|
public async Task SelfNotForServerConsole()
|
|
{
|
|
await Server.WaitAssertion(() =>
|
|
{
|
|
ExpectError<NotForServerConsoleError>();
|
|
InvokeCommand("self", out _);
|
|
});
|
|
}
|
|
}
|