mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-22 20:48:56 +01:00
Allows for offloaded tests to be focused (#71719)
Focusing a test through TEST_FOCUS allows you to only run that one test. It's very useful for developing. However, we have a bunch of offloaded tests in `#ifdef UNIT_TESTS` that would not be focused. This changes it so that those tests will now only run if either no test is focused, or if their specific "focus only" test is focused. This is done through a `PERFORM_ALL_TESTS` macro that replaces the `#ifdef UNIT_TESTS`. This is completely free because `if (FALSE)` constant folds. Hide whitespace mode recommended.
This commit is contained in:
@@ -13,11 +13,10 @@
|
||||
if(initial(D.research_icon) && initial(D.research_icon_state)) //If the design has an icon replacement skip the rest
|
||||
icon_file = initial(D.research_icon)
|
||||
icon_state = initial(D.research_icon_state)
|
||||
#ifdef UNIT_TESTS
|
||||
if(!(icon_state in icon_states(icon_file)))
|
||||
stack_trace("design [D] with icon '[icon_file]' missing state '[icon_state]'")
|
||||
continue
|
||||
#endif
|
||||
if (PERFORM_ALL_TESTS(focus_only/invalid_research_designs))
|
||||
if(!(icon_state in icon_states(icon_file)))
|
||||
stack_trace("design [D] with icon '[icon_file]' missing state '[icon_state]'")
|
||||
continue
|
||||
I = icon(icon_file, icon_state, SOUTH)
|
||||
|
||||
else
|
||||
@@ -46,11 +45,10 @@
|
||||
icon_file = initial(item.icon)
|
||||
|
||||
icon_state = initial(item.icon_state)
|
||||
#ifdef UNIT_TESTS
|
||||
if(!(icon_state in icon_states(icon_file)))
|
||||
stack_trace("design [D] with icon '[icon_file]' missing state '[icon_state]'")
|
||||
continue
|
||||
#endif
|
||||
if (PERFORM_ALL_TESTS(focus_only/invalid_research_designs))
|
||||
if(!(icon_state in icon_states(icon_file)))
|
||||
stack_trace("design [D] with icon '[icon_file]' missing state '[icon_state]'")
|
||||
continue
|
||||
I = icon(icon_file, icon_state, SOUTH)
|
||||
|
||||
// computers (and snowflakes) get their screen and keyboard sprites
|
||||
|
||||
@@ -14,19 +14,18 @@
|
||||
icon_file = initial(item.icon)
|
||||
var/icon_state = initial(item.icon_state)
|
||||
|
||||
#ifdef UNIT_TESTS
|
||||
var/icon_states_list = icon_states(icon_file)
|
||||
if (!(icon_state in icon_states_list))
|
||||
var/icon_states_string
|
||||
for (var/an_icon_state in icon_states_list)
|
||||
if (!icon_states_string)
|
||||
icon_states_string = "[json_encode(an_icon_state)]([text_ref(an_icon_state)])"
|
||||
else
|
||||
icon_states_string += ", [json_encode(an_icon_state)]([text_ref(an_icon_state)])"
|
||||
if (PERFORM_ALL_TESTS(focus_only/invalid_vending_machine_icon_states))
|
||||
var/icon_states_list = icon_states(icon_file)
|
||||
if (!(icon_state in icon_states_list))
|
||||
var/icon_states_string
|
||||
for (var/an_icon_state in icon_states_list)
|
||||
if (!icon_states_string)
|
||||
icon_states_string = "[json_encode(an_icon_state)]([text_ref(an_icon_state)])"
|
||||
else
|
||||
icon_states_string += ", [json_encode(an_icon_state)]([text_ref(an_icon_state)])"
|
||||
|
||||
stack_trace("[item] does not have a valid icon state, icon=[icon_file], icon_state=[json_encode(icon_state)]([text_ref(icon_state)]), icon_states=[icon_states_string]")
|
||||
continue
|
||||
#endif
|
||||
stack_trace("[item] does not have a valid icon state, icon=[icon_file], icon_state=[json_encode(icon_state)]([text_ref(icon_state)]), icon_states=[icon_states_string]")
|
||||
continue
|
||||
|
||||
var/icon/I = icon(icon_file, icon_state, SOUTH)
|
||||
var/c = initial(item.color)
|
||||
|
||||
Reference in New Issue
Block a user