X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=blobdiff_plain;f=qcsrc%2Fcommon%2Fcommand%2Fgeneric.qc;h=4ca8b3780c3d4950c4644be777260836d8da4c01;hp=6643387f8896069d615ecb4a15624b2c665aaa23;hb=15a6e2cb8dfd68d8fedc67d2b140ca70dfe695e2;hpb=14fe3988cd7c1989a879e0e8d952ba0978da6d62 diff --git a/qcsrc/common/command/generic.qc b/qcsrc/common/command/generic.qc index 6643387f8..4ca8b3780 100644 --- a/qcsrc/common/command/generic.qc +++ b/qcsrc/common/command/generic.qc @@ -436,17 +436,21 @@ void GenericCommand_restartnotifs(float request) print(sprintf( strcat( "Restart_Notifications(): Restarting %d notifications... ", - "Counts: MSG_INFO = %d, MSG_CENTER = %d, MSG_MULTI = %d\n" + "Counts: MSG_ANNCE = %d, MSG_INFO = %d, MSG_CENTER = %d, MSG_MULTI = %d, MSG_CHOICE = %d\n" ), ( + NOTIF_ANNCE_COUNT + NOTIF_INFO_COUNT + NOTIF_CENTER_COUNT + - NOTIF_MULTI_COUNT - ), + NOTIF_MULTI_COUNT + + NOTIF_CHOICE_COUNT + ), + NOTIF_ANNCE_COUNT, NOTIF_INFO_COUNT, NOTIF_CENTER_COUNT, - NOTIF_MULTI_COUNT - )); + NOTIF_MULTI_COUNT, + NOTIF_CHOICE_COUNT + )); Destroy_All_Notifications(); CALL_ACCUMULATED_FUNCTION(RegisterNotifications); #else @@ -523,6 +527,32 @@ void GenericCommand_settemp_restore(float request, float argc) } } +void GenericCommand_runtest(float request, float argc) +{ + switch(request) + { + case CMD_REQUEST_COMMAND: + { + if(argc > 1) + { + float i; + for(i = 1; i < argc; ++i) + TEST_Run(argv(i)); + } + else + TEST_RunAll(); + return; + } + + default: + case CMD_REQUEST_USAGE: + { + print(strcat("\nUsage:^3 ", GetProgramCommandPrefix(), " [function to run]")); + return; + } + } +} + /* use this when creating a new command, making sure to place it in alphabetical order... also, ** ADD ALL NEW COMMANDS TO commands.cfg WITH PROPER ALIASES IN THE SAME FASHION! void GenericCommand_(float request) @@ -563,6 +593,7 @@ void GenericCommand_(float request) GENERIC_COMMAND("rpn", GenericCommand_rpn(request, arguments, command), "RPN calculator") \ GENERIC_COMMAND("settemp", GenericCommand_settemp(request, arguments), "Temporarily set a value to a cvar which is restored later") \ GENERIC_COMMAND("settemp_restore", GenericCommand_settemp_restore(request, arguments), "Restore all cvars set by settemp command") \ + GENERIC_COMMAND("runtest", GenericCommand_runtest(request, arguments), "Run unit tests") \ /* nothing */ void GenericCommand_macro_help()