mirror of
https://github.com/space-wizards/RobustToolbox.git
synced 2026-02-14 19:29:36 +01:00
Make toolshed's CommandImplementationAttribute optional (#6218)
This commit is contained in:
@@ -215,3 +215,18 @@ public sealed class TestNestedEnumerableCommand : ToolshedCommand
|
||||
[CommandImplementation]
|
||||
public IEnumerable<ProtoId<EntityCategoryPrototype>> Impl() => _arr.OrderByDescending(x => x.Id);
|
||||
}
|
||||
|
||||
[ToolshedCommand]
|
||||
public sealed class TestImplicitImplCommand : ToolshedCommand
|
||||
{
|
||||
public int Impl() => 1;
|
||||
}
|
||||
|
||||
[ToolshedCommand]
|
||||
public sealed class TestExplicitImplCommand : ToolshedCommand
|
||||
{
|
||||
public int Impl() => 1;
|
||||
|
||||
[CommandImplementation]
|
||||
public int Impl2() => 2;
|
||||
}
|
||||
|
||||
@@ -60,6 +60,10 @@ public sealed class ToolshedTests : ToolshedTest
|
||||
Assert.Throws<AssertionException>(() => ParseError<OutOfInputError>("i 2"));
|
||||
Assert.That(ExpectedErrors.Count, Is.EqualTo(1));
|
||||
ExpectedErrors.Clear();
|
||||
|
||||
// Check that the CommandImplementationAttibute is optional when the type only defines one method.
|
||||
AssertResult("testimplicitimpl", 1);
|
||||
AssertResult("testexplicitimpl", 2);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user