Files
Bubberstation/code/modules/unit_tests/mindbound_actions.dm
san7890 66d070a586 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).
2023-02-16 21:54:04 +00:00

30 lines
1.1 KiB
Plaintext

/**
* Tests that actions assigned to a mob's mind
* are successfuly transferred when their mind is transferred to a new mob.
*/
/datum/unit_test/actions_moved_on_mind_transfer
/datum/unit_test/actions_moved_on_mind_transfer/Run()
var/mob/living/carbon/human/wizard = allocate(/mob/living/carbon/human/consistent)
var/mob/living/basic/pet/dog/corgi/wizard_dog = allocate(/mob/living/basic/pet/dog/corgi)
wizard.mind_initialize()
var/datum/action/cooldown/spell/pointed/projectile/fireball/fireball = new(wizard.mind)
fireball.Grant(wizard)
var/datum/action/cooldown/spell/aoe/magic_missile/missile = new(wizard.mind)
missile.Grant(wizard)
var/datum/action/cooldown/spell/jaunt/ethereal_jaunt/jaunt = new(wizard.mind)
jaunt.Grant(wizard)
var/datum/mind/wizard_mind = wizard.mind
wizard_mind.transfer_to(wizard_dog)
TEST_ASSERT_EQUAL(wizard_dog.mind, wizard_mind, "Mind transfer failed to occur, which invalidates the test.")
for(var/datum/action/cooldown/spell/remaining_spell in wizard.actions)
TEST_FAIL("Spell: [remaining_spell] failed to transfer minds when a mind transfer occured.")
qdel(fireball)
qdel(missile)
qdel(jaunt)