mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-20 03:30:01 +01:00
## About The Pull Request simply adds a new unit test, `language_key_conflicts`, ported from my work on monkestation. it is exactly what it says on the tin - it ensures two languages do not have the same exact key. i don't think that's an issue here, but better safe than sorry. ## Why It's Good For The Game more unit test coverage for subtle bugs that might be hard to realize is always nice ## Changelog No user-facing changes.
16 lines
662 B
Plaintext
16 lines
662 B
Plaintext
/// This test ensures that multiple languages aren't mapped to the same prefix key.
|
|
/datum/unit_test/language_key_conflicts
|
|
|
|
/datum/unit_test/language_key_conflicts/Run()
|
|
var/list/used_keys = list()
|
|
for(var/datum/language/language as anything in subtypesof(/datum/language))
|
|
var/name = language::name
|
|
var/key = language::key
|
|
if(!key)
|
|
TEST_FAIL("[name] ([language]) does not have a prefix!")
|
|
else if(used_keys[key])
|
|
var/datum/language/conflicting_language = used_keys[key]
|
|
TEST_FAIL("[name] ([language]) uses the '[key]' prefix, which is also used by [conflicting_language::name] ([conflicting_language])!")
|
|
else
|
|
used_keys[key] = language
|