mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-28 07:38:05 +01:00
[MIRROR] Updates the Reagent Name unit test to also ensure searching by reagent name returns the correct reagent [MDB IGNORE] (#16694)
* Updates the Reagent Name unit test to also ensure searching by reagent name returns the correct reagent (#70223) * Updates the Reagent Name unit test to also ensure searching by reagent name returns the correct reagent Co-authored-by: pizzie11 <arandom11111@gmail.com>
This commit is contained in:
@@ -475,7 +475,7 @@
|
||||
..()
|
||||
|
||||
/datum/reagent/toxin/fakebeer //disguised as normal beer for use by emagged brobots
|
||||
name = "Beer...?"
|
||||
name = "B33r"
|
||||
description = "A specially-engineered sedative disguised as beer. It induces instant sleep in its target."
|
||||
color = "#664300" // rgb: 102, 67, 0
|
||||
metabolization_rate = 1.5 * REAGENTS_METABOLISM
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
/// Test that all reagent names are different in order to prevent #65231
|
||||
/// Test that all reagent names are different in order to prevent #65231 and tests that searching for that reagent by name gives the correct one
|
||||
/datum/unit_test/reagent_names
|
||||
|
||||
/datum/unit_test/reagent_names/Run()
|
||||
var/used_names = list()
|
||||
|
||||
for (var/datum/reagent/reagent as anything in subtypesof(/datum/reagent))
|
||||
// Make sure names are different
|
||||
var/name = initial(reagent.name)
|
||||
if (!name)
|
||||
continue
|
||||
@@ -13,3 +14,14 @@
|
||||
TEST_FAIL("[used_names[name]] shares a name with [reagent] ([name])")
|
||||
else
|
||||
used_names[name] = reagent
|
||||
|
||||
// Now make sure searching for that name gets us the right reagent
|
||||
var/datum/reagent/found_reagent = get_chem_id(name)
|
||||
|
||||
if (!found_reagent)
|
||||
TEST_FAIL("Searching for [reagent] ([name]) returned nothing")
|
||||
|
||||
var/found_name = initial(found_reagent.name)
|
||||
|
||||
if (found_reagent != reagent)
|
||||
TEST_FAIL("Searching for [reagent] ([name]) returned [found_reagent] ([found_name]) instead")
|
||||
|
||||
Reference in New Issue
Block a user