Files
RobustToolbox/Robust.UnitTesting/Shared/Toolshed/ErrorHandlingTest.cs
T
909fd326a0 Toolshed part 2 (#4256)
* Save work.

* three billion tweaks

* Rune-aware parser.

* a

* all shedded out for the night

* a

* oogh

* Publicizes a lot of common generic commands, so custom toolshed envs can include them.

* Implement parsing for all number types.

* i think i might implode

* a

* Tests.

* a

* Enum parser test.

* do u like parsers

* oopls

* ug fixes

* Toolshed is approaching a non-insignificant part of the engine's size.

* Pool toolshed's tests, also type tests.

* bwa

* tests pass :yay:

* Update Robust.Shared/CVars.cs

Co-authored-by: DrSmugleaf <DrSmugleaf@users.noreply.github.com>

* how did this not fail tests

* awa

* many levels of silly

---------

Co-authored-by: moonheart08 <moonheart08@users.noreply.github.com>
Co-authored-by: DrSmugleaf <DrSmugleaf@users.noreply.github.com>
2023-08-23 16:03:34 -05:00

42 lines
979 B
C#

using System.Threading.Tasks;
using NUnit.Framework;
using Robust.Shared.GameObjects;
using Robust.Shared.Toolshed.Errors;
namespace Robust.UnitTesting.Shared.Toolshed;
[TestFixture]
public 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 _);
});
}
}