-
Notifications
You must be signed in to change notification settings - Fork 271
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Fixes Ticked File Enforcement and Missing Unit Test (and makes said Unit Test Compile) (and genericizes the C&D list to the base unit test datum) (#77632) Closes #77631 Hey there, Ticked File Enforcement simply wasn't catching files that were missed. That's a bit stupid, so I decided to look into what the issue might be, and whoopsie daisies I did double periods back in #76592 (020ac24). ![image](https://github.com/tgstation/tgstation/assets/34697715/6023afe8-313d-4550-9a60-58a8bc211b4f) I also added some debug info and some more checks to prevent such a break from happening again on runtime of this script. I thought it was a weird string concatenation issue (and not the simple break I thought it was), so I rewrote how it adds `glob`s. I think it's cleaner so I'll keep it anyhow This PR also corrects the oversight of the missing unit test (introduced in #77218 (6982760)) by reticking it in the `_unit_tests.dm` file, and also makes it compile because it didn't do that. I also then had to do some more work to get the unit test to work. * Genericizes the Create-and-Destroy "ignore" list to be a static list on `/datum/unit_test` to allow it to be shared between these types of tests that we need to test. * Adds that list to C&D and the broken unit test regarding fantasy bonuses * Fixes some actually broken that the unit test was made to catch (beam rifles, butterdogs and other slippery items, random ingredient boxes). * Adds cases for things that the unit test and overall framework really shouldn't be altering anyways (mythril), and was likely causing inappropriate stack traces on master Unit Tests WORK. Tools WORK. ![image](https://github.com/tgstation/tgstation/assets/34697715/9a59c0db-7a33-4546-918b-c73372a5b867) :cl: fix: Beam rifles will no longer inappropriately retain any bonuses they may gain from wizardry. fix: Inappropriate stack traces over bonuses being applied to components that gain bonuses innately (like Mythril stacks) should cease. /:cl: * fix unticked unit test * Dumb fix --------- Co-authored-by: san7890 <[email protected]>
- Loading branch information
Showing
13 changed files
with
75 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
/atom/proc/effective_contents(list/typecache = null) | ||
var/static/list/default_typecache | ||
if(!typecache) | ||
default_typecache ||= typecacheof(list(/obj/effect, /atom/movable/screen)) | ||
typecache = default_typecache | ||
return typecache_filter_list_reverse(src.contents, typecache) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,46 @@ | ||
// Unit test to make sure that there are no duplicate keys when modify_fantasy_variable is called when applying fantasy bonuses. | ||
// Also to make sure the fantasy_modifications list is null when fantasy bonuses are removed. | ||
/datum/unit_test/modify_fantasy_variable | ||
priority = TEST_LONGER | ||
|
||
/datum/unit_test/modify_fantasy_variable/Run() | ||
var/list/applicable_types = subtypesof(/obj/item) - uncreatables | ||
|
||
for(var/obj/item/path as anything in subtypesof(/obj/item)) | ||
for(var/obj/item/path as anything in applicable_types) | ||
var/obj/item/object = allocate(path) | ||
// objects will have fantasy bonuses inherent to their type (like butterdogs and the slippery component), so we need to take this into account | ||
var/number_of_extant_bonuses = LAZYLEN(object.fantasy_modifications) | ||
|
||
#define TEST_SUCCESS LAZYLEN(object.fantasy_modifications) == number_of_extant_bonuses | ||
|
||
// Try positive | ||
object.apply_fantasy_bonuses(bonus = 5) | ||
object.remove_fantasy_bonuses(bonus = 5) | ||
TEST_ASSERT_NULL(object.fantasy_modifications) | ||
TEST_ASSERT(TEST_SUCCESS, generate_failure_message(object)) | ||
|
||
// Then negative | ||
object.apply_fantasy_bonuses(bonus = -5) | ||
object.remove_fantasy_bonuses(bonus = -5) | ||
TEST_ASSERT_NULL(object.fantasy_modifications) | ||
TEST_ASSERT(TEST_SUCCESS, generate_failure_message(object)) | ||
|
||
// Now try the extremes of each | ||
object.apply_fantasy_bonuses(bonus = 500) | ||
object.remove_fantasy_bonuses(bonus = 500) | ||
TEST_ASSERT_NULL(object.fantasy_modifications) | ||
TEST_ASSERT(TEST_SUCCESS, generate_failure_message(object)) | ||
|
||
object.apply_fantasy_bonuses(bonus = -500) | ||
object.remove_fantasy_bonuses(bonus = -500) | ||
TEST_ASSERT_NULL(object.fantasy_modifications) | ||
TEST_ASSERT(TEST_SUCCESS, generate_failure_message(object)) | ||
|
||
/// Returns a string that we use to describe the failure of the test. | ||
/datum/unit_test/modify_fantasy_variable/proc/generate_failure_message(obj/item/failed_object) | ||
var/list/cached_modifications = failed_object.fantasy_modifications | ||
var/length_of_modifications = LAZYLEN(cached_modifications) | ||
var/list/failure_messages = list("Error found when adding+removing fantasy bonuses for [failed_object.type].") | ||
failure_messages += "The length of the fantasy_modifications list was [length_of_modifications]." | ||
if(length_of_modifications) | ||
failure_messages += "The fantasy_modifications list was [cached_modifications.Join(", ")]." | ||
|
||
return failure_messages.Join(" ") | ||
|
||
#undef TEST_SUCCESS |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters