Skip to content

Commit

Permalink
Fixes crashing issues
Browse files Browse the repository at this point in the history
  • Loading branch information
PowerfulBacon committed Aug 25, 2024
1 parent ff1888e commit 4e95a42
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions code/__HELPERS/test_helpers.dm
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,23 @@
/// It is appreciated to add the reason why the atom shouldn't be initialized if you add it to this list.
/datum/unit_test/proc/build_list_of_uncreatables()
RETURN_TYPE(/list)
return list()

#define CREATION_TEST_IGNORE_SELF(path)/datum/unit_test/build_list_of_uncreatables() {\
. = ..();\
. += path;\
var/list/output = list()
for (var/type in subtypesof(/datum/ignore_type))
var/datum/ignore_type/temp = new()
temp.add_ignores(output)
return output

// Extension procs crash byond with enough of them due to stack overflows, this allows us to do it
// without traversing the stack
/datum/ignore_type/proc/add_ignores(list/target)
return

#define CREATION_TEST_IGNORE_SELF(path)/datum/ignore_type/##path/add_ignores(list/target) {\
target += path;\
}

#define CREATION_TEST_IGNORE_SUBTYPES(path)/datum/unit_test/build_list_of_uncreatables() {\
. = ..();\
. += typesof(path);\
#define CREATION_TEST_IGNORE_SUBTYPES(path)/datum/ignore_type/##path/add_ignores(list/target) {\
target += typesof(path);\
}

// Annoyingly, dview is defined inside of _DEFINES, so we are doing it here
Expand Down

0 comments on commit 4e95a42

Please sign in to comment.