mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-10 10:12:45 +00:00
Adds color to unit tests
This commit is contained in:
4
code/__defines/unit_tests.dm
Normal file
4
code/__defines/unit_tests.dm
Normal file
@@ -0,0 +1,4 @@
|
||||
#define ASCII_ESC ascii2text(27)
|
||||
#define ASCII_RED "[ASCII_ESC]\[31m"
|
||||
#define ASCII_GREEN "[ASCII_ESC]\[32m"
|
||||
#define ASCII_RESET "[ASCII_ESC]\[0m"
|
||||
@@ -12,11 +12,11 @@ var/total_unit_tests = 0
|
||||
all_unit_tests_passed = 0
|
||||
failed_unit_tests++
|
||||
reported = 1
|
||||
log_unit_test("!! FAILURE !! \[[name]\]: [message]")
|
||||
log_unit_test("[ASCII_RED]!! FAILURE !! \[[name]\]: [message][ASCII_RESET]")
|
||||
|
||||
/datum/unit_test/proc/pass(var/message)
|
||||
reported = 1
|
||||
log_unit_test("** SUCCESS ** \[[name]\]: [message]")
|
||||
log_unit_test("[ASCII_GREEN]** SUCCESS ** \[[name]\]: [message][ASCII_RESET]")
|
||||
|
||||
/datum/unit_test/proc/start_test()
|
||||
fail("No test proc.")
|
||||
@@ -60,7 +60,7 @@ var/total_unit_tests = 0
|
||||
var/datum/unit_test/d = new test()
|
||||
|
||||
if(d.disabled)
|
||||
d.pass("Check Disabled: [d.disabled]")
|
||||
d.pass("[ASCII_RED]Check Disabled: [d.disabled][ASCII_RESET]")
|
||||
continue
|
||||
|
||||
if(findtext(d.name, "template"))
|
||||
@@ -92,8 +92,8 @@ var/total_unit_tests = 0
|
||||
test.fail("Test failed to report a result.")
|
||||
|
||||
if(all_unit_tests_passed)
|
||||
log_unit_test("*** All Unit Tests Passed \[[total_unit_tests]\] ***")
|
||||
log_unit_test("[ASCII_GREEN]*** All Unit Tests Passed \[[total_unit_tests]\] ***[ASCII_RESET]")
|
||||
world.Del()
|
||||
else
|
||||
log_unit_test("!!! \[[failed_unit_tests]\\[total_unit_tests]\] Unit Tests Failed !!!")
|
||||
log_unit_test("[ASCII_RED]!!! \[[failed_unit_tests]\\[total_unit_tests]\] Unit Tests Failed !!![ASCII_RESET]")
|
||||
world.Del()
|
||||
@@ -34,6 +34,7 @@
|
||||
#include "code\__defines\species_languages.dm"
|
||||
#include "code\__defines\targeting.dm"
|
||||
#include "code\__defines\turfs.dm"
|
||||
#include "code\__defines\unit_tests.dm"
|
||||
#include "code\_compatibility\509\_JSON.dm"
|
||||
#include "code\_compatibility\509\JSON Reader.dm"
|
||||
#include "code\_compatibility\509\JSON Writer.dm"
|
||||
|
||||
Reference in New Issue
Block a user