- Added some testing mixin template
This commit is contained in:
Tristan B. Velloza Kildaire 2023-11-18 11:11:54 +02:00
parent 0d5b7c42e4
commit 455bd6fa06
1 changed files with 27 additions and 0 deletions

27
source/dante/tings.d Normal file
View File

@ -0,0 +1,27 @@
module dante.tings;
import dante;
import dante.exceptions : ProtocolException;
import davinci.base : Command;
public mixin template Expect_n_handle(ExpectedType, alias command)
if(__traits(isSame, typeof(command), Command))
{
/**
* Check that we can cast to `ExpectedType`
*
* If not, we throw anexception
*/
ExpectedType expectedMessage = cast(ExpectedType)command;
void Expect_n_handle()
{
import std.stdio : writeln;
writeln("Hello testing");
if(expectedMessage is null)
{
throw ProtocolException.expectedMessageKind(expectedMessage.classinfo, command);
}
}
}