Files
Bubberstation/code/modules/unit_tests/spell_invocations.dm
SkyratBot aa8d114bff [MIRROR] Wraps all instances of invoking Fail() into the TEST_FAIL Macro [MDB IGNORE] (#19384)
* Wraps all instances of invoking Fail() into the TEST_FAIL Macro (#73407)

We shouldn't really be invoking the proc itself because then we don't
pass along the failing line/file to our consumers, let's use the macro
in all instances that really need it.

I noticed people were invoking the `Fail()` proc directly rather than
using `TEST_FAIL` instead, so they weren't getting those neat
annotations on their failing code because we never passed along the
failing line/file to actually apply those annotations. That's silly. We
don't even return on `TEST_FAIL` either, so there's no reason to not do
this (only upsides wahoo).

* Wraps all instances of invoking Fail() into the TEST_FAIL Macro

* Correct macro in opfor unit test

---------

Co-authored-by: san7890 <the@san7890.com>
Co-authored-by: Tastyfish <crazychris32@gmail.com>
2023-02-16 19:41:29 -05:00

27 lines
1.1 KiB
Plaintext

/**
* Validates that all spells have a correct
* invocation type and invocation setup.
*/
/datum/unit_test/spell_invocations
/datum/unit_test/spell_invocations/Run()
var/list/types_to_test = subtypesof(/datum/action/cooldown/spell)
for(var/datum/action/cooldown/spell/spell_type as anything in types_to_test)
var/spell_name = initial(spell_type.name)
var/invoke_type = initial(spell_type.invocation_type)
switch(invoke_type)
if(INVOCATION_EMOTE)
if(isnull(initial(spell_type.invocation_self_message)))
TEST_FAIL("Spell: [spell_name] ([spell_type]) set emote invocation type but did not set a self message.")
if(isnull(initial(spell_type.invocation)))
TEST_FAIL("Spell: [spell_name] ([spell_type]) set emote invocation type but did not set an invocation message.")
if(INVOCATION_SHOUT, INVOCATION_WHISPER)
if(isnull(initial(spell_type.invocation)))
TEST_FAIL("Spell: [spell_name] ([spell_type]) set a speaking invocation type but did not set an invocation message.")
// INVOCATION_NONE:
// It doesn't matter what they have set for invocation text. So not it's skipped.