using System.Collections.Generic; using Robust.Shared.GameObjects; using Robust.Shared.Toolshed; using Robust.Shared.Toolshed.Syntax; using Robust.Shared.Toolshed.TypeParsers; namespace Content.IntegrationTests.Tests.Toolshed; [TestFixture] public sealed class CommandRunTest : ToolshedTest { [Test] public async Task SimpleCommandRun() { await Server.WaitAssertion(() => { ParseCommand("entities"); ParseCommand("entities select 1"); ParseCommand("entities with Item select 1"); ExpectError(); ParseCommand("entities with"); ExpectError(); ParseCommand("player:list with MetaData"); ExpectError(); ParseCommand("player:list", expectedType: typeof(IEnumerable)); ParseCommand("entities not with MetaData"); ParseCommand("with MetaData select 2 any", inputType: typeof(List)); ParseCommand("entities not with MetaData => $myEntities"); ParseCommand("=> $fooBar with MetaData", inputType: typeof(List)); }); } [Test] public async Task EntityUidTypeParser() { await Server.WaitAssertion(() => { ParseCommand("ent 1"); ParseCommand("ent c1"); ExpectError(); ParseCommand("ent foodigity"); }); } [Test] public async Task QuantityTypeParser() { await Server.WaitAssertion(() => { ParseCommand("entities select 100"); ParseCommand("entities select 50%"); ExpectError(); ParseCommand("entities select -1"); ExpectError(); ParseCommand("entities select 200%"); ExpectError(); ParseCommand("entities select hotdog"); }); } [Test] public async Task ComponentTypeParser() { await Server.WaitAssertion(() => { ParseCommand("entities with MetaData"); ExpectError(); ParseCommand("entities with Foodiddy"); ExpectError(); ParseCommand("entities with MetaDataComponent"); }); } }