mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-07-21 04:57:57 +01:00
Unit tests radio, saymode, and language prefix keys (#71328)
## About The Pull Request This PR unit tests radio/saymode prefixes together, and language prefixes on their own, for any possible overlaps and duplicates Moved mafia saymode key to :1 and holopad key to :2, we're running out of radio keys and i'm too afraid to move to 2-letter ## Why It's Good For The Game 1. Unit tests are good 2. https://github.com/tgstation/tgstation/pull/71326 this is bad 🆑 spellcheck: Mafia changeling say prefix is now :1, and holopad say is now :2 /🆑 Co-authored-by: Zephyr <12817816+ZephyrTFA@users.noreply.github.com>
This commit is contained in:
@@ -120,6 +120,7 @@
|
||||
#include "inhands.dm"
|
||||
#include "json_savefile_importing.dm"
|
||||
#include "keybinding_init.dm"
|
||||
#include "key_prefixes.dm"
|
||||
#include "knockoff_component.dm"
|
||||
#include "limbsanity.dm"
|
||||
#include "load_map_security.dm"
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
/// A unit test to ensure radio and language prefix keys don't overlap
|
||||
/datum/unit_test/key_prefixes
|
||||
|
||||
/datum/unit_test/key_prefixes/Run()
|
||||
// Languages first
|
||||
// Assoc list of key:lang type
|
||||
var/list/language_keys = list()
|
||||
for(var/datum/language/language_type as anything in subtypesof(/datum/language))
|
||||
if(initial(language_type.key) in language_keys)
|
||||
TEST_FAIL("[language_type] language has the same prefix key ([initial(language_type.key)]) as [language_keys[initial(language_type.key)]]")
|
||||
language_keys[initial(language_type.key)] = language_type
|
||||
|
||||
// Now radioes
|
||||
|
||||
// Assoc list of key:name (or type in the cases of saymodes)
|
||||
var/list/radio_keys = list()
|
||||
|
||||
for(var/radio_key in GLOB.department_radio_keys)
|
||||
if(radio_key in radio_keys)
|
||||
TEST_FAIL("[GLOB.department_radio_keys[radio_key]] radio channel has the same prefix key ([radio_key]) as [GLOB.department_radio_keys[radio_keys.Find(radio_key)]]")
|
||||
radio_keys[radio_key] = GLOB.department_radio_keys[radio_key]
|
||||
|
||||
for(var/datum/saymode/say_type as anything in subtypesof(/datum/saymode))
|
||||
if(initial(say_type.key) in radio_keys)
|
||||
TEST_FAIL("[say_type] saymode has the same prefix key ([initial(say_type.key)]) as [radio_keys[initial(say_type.key)]]")
|
||||
radio_keys[initial(say_type.key)] = say_type
|
||||
Reference in New Issue
Block a user