mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-22 19:47:22 +01:00
Add ability to check chatlog for test assertions. (#27727)
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
GLOBAL_LIST_EMPTY(game_test_chats)
|
||||
|
||||
/// For advanced cases, fail unconditionally but don't return (so a test can return multiple results)
|
||||
#define TEST_FAIL(reason) (Fail(reason || "No reason", __FILE__, __LINE__))
|
||||
|
||||
|
||||
@@ -66,3 +66,10 @@
|
||||
|
||||
/datum/test_puppeteer/proc/rejuvenate()
|
||||
puppet.rejuvenate()
|
||||
|
||||
/datum/test_puppeteer/proc/last_chatlog_has_text(snippet)
|
||||
if(!(puppet.mind.key in GLOB.game_test_chats))
|
||||
return FALSE
|
||||
var/list/puppet_chat_list = GLOB.game_test_chats[puppet.mind.key]
|
||||
var/last_chat_html = puppet_chat_list[length(puppet_chat_list)]
|
||||
return findtextEx(last_chat_html, snippet)
|
||||
|
||||
@@ -6,10 +6,9 @@
|
||||
player.click_on(janicart)
|
||||
TEST_ASSERT_EQUAL(janicart.inserted_key, janicart_key, "did not find janicart key in vehicle")
|
||||
|
||||
var/move_delay = janicart.vehicle_move_delay
|
||||
player.spawn_obj_in_hand(/obj/item/borg/upgrade/vtec)
|
||||
player.click_on(janicart)
|
||||
TEST_ASSERT(janicart.vehicle_move_delay < move_delay, "VTEC upgrade not applied properly")
|
||||
TEST_ASSERT(player.last_chatlog_has_text("You upgrade the janicart"), "VTEC upgrade not applied properly")
|
||||
|
||||
TEST_ASSERT_NULL(janicart.mybag, "unexpected trash bag on janicart")
|
||||
var/obj/item/storage/bag/trash/bag = player.spawn_obj_in_hand(/obj/item/storage/bag/trash)
|
||||
|
||||
Reference in New Issue
Block a user