Files
Bubberstation/code/modules/unit_tests/tgui_create_message.dm
SkyratBot afb521f2ee [MIRROR] Micro-optimize TGUI_CREATE_MESSAGE for 70% (?) speed ups (#5753)
* Micro-optimize TGUI_CREATE_MESSAGE (#59142)

* Micro-optimize TGUI_CREATE_MESSAGE for 70% (?) speed ups

Co-authored-by: Mothblocks <35135081+Mothblocks@users.noreply.github.com>
2021-05-17 11:41:45 +01:00

29 lines
718 B
Plaintext

/// Test that `TGUI_CREATE_MESSAGE` is correctly implemented
/datum/unit_test/tgui_create_message
/datum/unit_test/tgui_create_message/Run()
var/type = "something/here"
var/list/payload = list(
"name" = "Terry McTider",
"heads_caved" = 100,
"accomplishments" = list(
"nothing",
"literally nothing",
list(
"something" = "just kidding",
),
),
)
var/message = TGUI_CREATE_MESSAGE(type, payload)
// Ensure consistent output to compare by performing a round-trip.
var/output = json_encode(json_decode(url_decode(message)))
var/expected = json_encode(list(
"type" = type,
"payload" = payload,
))
TEST_ASSERT_EQUAL(expected, output, "TGUI_CREATE_MESSAGE didn't round trip properly")