Skip to content

Commit

Permalink
[MIRROR] Gets rid of UNIT_TESTS compiler warning (#2077)
Browse files Browse the repository at this point in the history
* Gets rid of UNIT_TESTS compiler warning (#82695)

## About The Pull Request

Basically every single CI Run is throwing the following warning:
```txt
code/modules/unit_tests/lootpanel.dm:24:warning (unused_var): new_box: variable defined but not used
```

You may find an example here:
https://github.com/tgstation/tgstation/actions/runs/8698627681/job/23855921813#step:9:24

This is pretty silly but I don't really know why we even have this
variable (I assume there's something far more complicated underneath the
surface based on what the unit test is asserting), but assuming it is
important let's just insert a do-nothing procedure to get rid of the
compiler warning while ensuring the unit test is actually operating as
it should.

I also don't really like the fact that this is a warning instead of an
error but let's tackle this problem one step at a time by at least
getting rid of the compiler warning in a quick advance PR while I dwell
on this issue (is there a way to get the Dreamchecker linter to look at
the unit test files? it's caught perfectly fine in the langserver)

---------

Co-authored-by: MrMelbert <[email protected]>

* Gets rid of UNIT_TESTS compiler warning

---------

Co-authored-by: san7890 <[email protected]>
Co-authored-by: MrMelbert <[email protected]>
  • Loading branch information
3 people authored and StealsThePRs committed Apr 19, 2024
1 parent cd8ed59 commit 2cc309f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion code/modules/unit_tests/lootpanel.dm
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
TEST_ASSERT_EQUAL(length(panel.contents), 1, "Contents should update on searchobj deleted")
TEST_ASSERT_EQUAL(length(panel.to_image), 1, "to_image should update on searchobj deleted")

var/obj/item/storage/toolbox/new_box = allocate(/obj/item/storage/toolbox, one_over)
allocate(/obj/item/storage/toolbox, one_over)
TEST_ASSERT_EQUAL(length(panel.contents), 1, "Contents shouldn't update, we're dumb")
TEST_ASSERT_EQUAL(length(panel.to_image), 1, "to_image shouldn't update, we're dumb")

Expand All @@ -32,3 +32,4 @@
TEST_ASSERT_EQUAL(length(panel.contents), 2, "Panel shouldnt dupe searchables if reopened")

mock_client.mob = null

0 comments on commit 2cc309f

Please sign in to comment.