From 0fcf7d04a246fadc976878a266bb7fb72af71639 Mon Sep 17 00:00:00 2001 From: Jared-Fogle <35135081+Jared-Fogle@users.noreply.github.com> Date: Sat, 5 Sep 2020 07:38:11 -0700 Subject: [PATCH] Add test for emotes (#53430) --- code/modules/unit_tests/_unit_tests.dm | 1 + code/modules/unit_tests/emoting.dm | 25 +++++++++++++++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 code/modules/unit_tests/emoting.dm diff --git a/code/modules/unit_tests/_unit_tests.dm b/code/modules/unit_tests/_unit_tests.dm index 318d9f1bae3..ff22ba4fb31 100644 --- a/code/modules/unit_tests/_unit_tests.dm +++ b/code/modules/unit_tests/_unit_tests.dm @@ -17,6 +17,7 @@ #include "chain_pull_through_space.dm" #include "component_tests.dm" #include "confusion.dm" +#include "emoting.dm" #include "keybinding_init.dm" #include "machine_disassembly.dm" #include "medical_wounds.dm" diff --git a/code/modules/unit_tests/emoting.dm b/code/modules/unit_tests/emoting.dm new file mode 100644 index 00000000000..5795ab34374 --- /dev/null +++ b/code/modules/unit_tests/emoting.dm @@ -0,0 +1,25 @@ +/datum/unit_test/emoting + var/emotes_used = 0 + +/datum/unit_test/emoting/Run() + var/mob/living/carbon/human/human = allocate(/mob/living/carbon/human) + RegisterSignal(human, COMSIG_MOB_EMOTE, .proc/on_emote_used) + + human.say("*shrug") + TEST_ASSERT_EQUAL(emotes_used, 1, "Human did not shrug") + + human.say("*beep") + TEST_ASSERT_EQUAL(emotes_used, 1, "Human beeped, when that should be restricted to silicons") + + human.setOxyLoss(140) + + TEST_ASSERT(human.stat != CONSCIOUS, "Human is somehow conscious after receiving suffocation damage") + + human.say("*shrug") + TEST_ASSERT_EQUAL(emotes_used, 1, "Human shrugged while unconscious") + + human.say("*deathgasp") + TEST_ASSERT_EQUAL(emotes_used, 2, "Human could not deathgasp while unconscious") + +/datum/unit_test/emoting/proc/on_emote_used() + emotes_used += 1