mirror of
https://github.com/space-wizards/RobustToolbox.git
synced 2026-09-06 17:58:05 +02:00
* Toolshed Rejig * shorten hint string * Try fix conflicts. Ill make with work later * bodge * Fix ProtoIdTypeParser assert * comment * AllEntities * Remove more linq from WhereCommand * better help strings * Add ContainsCommand * loc strings * Add contains command description * Add $self variable * Errors for writing to readonly variables * A
45 lines
1.6 KiB
C#
45 lines
1.6 KiB
C#
using System.Collections.Generic;
|
|
using System.Globalization;
|
|
using System.Threading.Tasks;
|
|
using NUnit.Framework;
|
|
using Robust.Shared.Localization;
|
|
using Robust.Shared.Toolshed;
|
|
|
|
namespace Robust.UnitTesting.Shared.Toolshed;
|
|
|
|
[TestFixture]
|
|
public sealed class LocTest : ToolshedTest
|
|
{
|
|
[Test]
|
|
public async Task AllCommandsHaveDescriptions()
|
|
{
|
|
var locMan = Server.ResolveDependency<ILocalizationManager>();
|
|
var toolMan = Server.ResolveDependency<ToolshedManager>();
|
|
var locStrings = new HashSet<string>();
|
|
|
|
// Its neat that you can mostly do this via toolshed and all, but I'm still gonna turn it into a "real" test.
|
|
// Assert.That(InvokeCommand("cmd:list where { cmd:descloc loc:tryloc isnull }", out var res));
|
|
// Assert.That((IEnumerable<CommandSpec>)res!, Is.Empty, "All commands must have localized descriptions.");
|
|
|
|
var testAssembly = typeof(LocTest).Assembly;
|
|
|
|
await Server.WaitAssertion(() =>
|
|
{
|
|
locMan.LoadCulture(new CultureInfo("en-US"));
|
|
|
|
Assert.Multiple(() =>
|
|
{
|
|
foreach (var cmd in toolMan.DefaultEnvironment.AllCommands())
|
|
{
|
|
if (cmd.Cmd.GetType().Assembly == testAssembly)
|
|
continue;
|
|
|
|
var descLoc = cmd.DescLocStr();
|
|
Assert.That(locStrings.Add(descLoc), $"Duplicate command description key: {descLoc}");
|
|
Assert.That(locMan.TryGetString(descLoc, out _), $"Failed to get command description for command {cmd.FullName()}");
|
|
}
|
|
});
|
|
});
|
|
}
|
|
}
|