Makes integration test results be in color and have annotations (#66649)

About The Pull Request

    Separated compiling the integration tests and running them as separate steps for organization purposes.
    Added a TEST_ASSERT_NULL(value, reason) and TEST_ASSERT_NOTNULL(value, reason) because those are conceptually simple tests.
    Makes the PASS and FAIL prefixes in the integration test log be green and red for better readability.
    Failure reasons now display the file and line number.
        In order to achieve this, direct calls to Fail() are now wrapped in a macro, TEST_FAIL(), as Fail() itself needs preprocessor stuff passed to it.
        In the midst of updating it, I noticed multiple cases of tests directly calling Fail() and returning when they should have used a better macro, so those were updated. There was at least one case where it appeared that the code assumed that the test ended at Fail(), but made no attempt to do so, such as with the RCD test.
        Feel free to double check all of the changed unit tests in case I made a functional behavior change, but they currently pass.
    To take advantage of the previous change, failures are now marked as annotations. Note that outside of github, this creates an ugly-looking line but the primary environment is as a github action.

Examples with intentionally botched unit test:

image

image

image
Why It's Good For The Game

Makes inspecting failed unit tests significantly easier.
Changelog

N/A
This commit is contained in:
Tastyfish
2022-05-04 13:19:01 +12:00
committed by GitHub
parent b9e11b7f67
commit bca463316b
47 changed files with 155 additions and 129 deletions
+7 -7
View File
@@ -12,21 +12,21 @@
if (current_design.id == DESIGN_ID_IGNORE) //Don't check designs with ignore ID
continue
if (isnull(current_design.name) || current_design.name == default_design.name) //Designs with ID must have non default/null Name
Fail("Design [current_design.type] has default or null name var but has an ID")
TEST_FAIL("Design [current_design.type] has default or null name var but has an ID")
if ((!isnull(current_design.materials) && LAZYLEN(current_design.materials)) || (!isnull(current_design.reagents_list) && LAZYLEN(current_design.reagents_list))) //Design requires materials
if ((isnull(current_design.build_path) || current_design.build_path == default_design.build_path) && (isnull(current_design.make_reagents) || current_design.make_reagents == default_design.make_reagents)) //Check if design gives any output
Fail("Design [current_design.type] requires materials but does not have have any build_path or make_reagents set")
TEST_FAIL("Design [current_design.type] requires materials but does not have have any build_path or make_reagents set")
else if (!isnull(current_design.build_path) || !isnull(current_design.build_path)) // //Design requires no materials but creates stuff
Fail("Design [current_design.type] requires NO materials but has build_path or make_reagents set")
TEST_FAIL("Design [current_design.type] requires NO materials but has build_path or make_reagents set")
for(var/path in subtypesof(/datum/design/surgery))
var/datum/design/surgery/current_design = new path //Create an instance of each design
if (isnull(current_design.id) || current_design.id == default_design_surgery.id) //Check if ID was not set
Fail("Surgery Design [current_design.type] has no ID set")
TEST_FAIL("Surgery Design [current_design.type] has no ID set")
if (isnull(current_design.id) || current_design.name == default_design_surgery.name) //Check if name was not set
Fail("Surgery Design [current_design.type] has default or null name var")
TEST_FAIL("Surgery Design [current_design.type] has default or null name var")
if (isnull(current_design.desc) || current_design.desc == default_design_surgery.desc) //Check if desc was not set
Fail("Surgery Design [current_design.type] has default or null desc var")
TEST_FAIL("Surgery Design [current_design.type] has default or null desc var")
if (isnull(current_design.surgery) || current_design.surgery == default_design_surgery.surgery) //Check if surgery was not set
Fail("Surgery Design [current_design.type] has default or null surgery var")
TEST_FAIL("Surgery Design [current_design.type] has default or null surgery var")