Unsilence log_mapping messages in unit tests that don't meet /datum/unit_test/maptest_log_mapping criteria (#96780)

This commit is contained in:
Roxy
2026-07-02 23:20:24 -06:00
committed by GitHub
parent 6fc38a8c9b
commit 6a0ee8a2c1
3 changed files with 11 additions and 13 deletions
+8 -2
View File
@@ -26,8 +26,14 @@
/// Logging for mapping errors
/proc/log_mapping(text, skip_world_log)
#ifdef UNIT_TESTS
GLOB.unit_test_mapping_logs += text
return
// Only add to fail list if AREACOORD was conveyed, and it's a station or mining z-level.
// This is due to mapping errors don't have coords being impossible to diagnose as a unit test,
// and various ruins frequently intentionally doing non-standard things.
if(GLOB.test_areacoord_regex.Find(text))
var/z = text2num(GLOB.test_areacoord_regex.group[1])
if(is_station_level(z) || is_mining_level(z))
GLOB.unit_test_mapping_logs += text
return
#endif
#ifdef MAP_TEST
message_admins("Mapping: [text]")
+3
View File
@@ -21,3 +21,6 @@ GLOBAL_DATUM_INIT(html_tags, /regex, regex(@"<.*?>", "g"))
GLOBAL_DATUM_INIT(filename_forbidden_chars, /regex, regex(@{""|[\\\n\t/?%*:|<>]|\.\."}, "g"))
GLOBAL_PROTECT(filename_forbidden_chars)
// had to use the OR operator for quotes instead of putting them in the character class because it breaks the syntax highlighting otherwise.
//Find AREACOORD() in log_mapping messages
GLOBAL_DATUM_INIT(test_areacoord_regex, /regex, regex(@"\(-?\d+,-?\d+,(-?\d+)\)"))
-11
View File
@@ -5,16 +5,5 @@
priority = TEST_PRE
/datum/unit_test/maptest_log_mapping/Run()
var/static/regex/test_areacoord_regex = regex(@"\(-?\d+,-?\d+,(-?\d+)\)")
for(var/log_entry in GLOB.unit_test_mapping_logs)
// Only fail if AREACOORD was conveyed, and it's a station or mining z-level.
// This is due to mapping errors don't have coords being impossible to diagnose as a unit test,
// and various ruins frequently intentionally doing non-standard things.
if(!test_areacoord_regex.Find(log_entry))
continue
var/z = text2num(test_areacoord_regex.group[1])
if(!is_station_level(z) && !is_mining_level(z))
continue
TEST_FAIL(log_entry)