Arch666Angel / mods

Angelsmods Repository
https://forums.factorio.com/viewforum.php?f=185
85 stars 61 forks source link

Data Stage Unit Tests #823

Open KiwiHawk opened 2 years ago

KiwiHawk commented 2 years ago

Data Stage Test Mods

Idea was suggested in discussion on PR #819.

Create two new testing mods to do data stage checks. One mod should run first, before any other mods. Other mod should run last.

Tests

Missing recipe tints

Currently, if the unit test mod is enabled, Angel's Petrochem will check for missing recipe tints and print a warning to log. This could be moved to the new mod.

Accidental globals

Check for references to undeclared variables and accidental globals. These type of issues had been fixed in #819.

setmetatable(_G, {
  __newindex = function (_, n)
    error("attempt to write to undeclared variable "..n)
  end,
  __index = function (_, n)
    error("attempt to read undeclared variable "..n)
  end,
})
LovelySanta commented 2 years ago

Create two new testing mods to do data stage checks. One mod should run first, before any other mods. Other mod should run last.

I am still of the opinion that the angelsdev-unit-test can take the role as the one loading last. If we do want to test some complex entities in the future (requiring custom event handling), then having the unit test run last will be wanted anyway... => 1 new mod to load before other mods => extend the unit test mod to do verifications on the 'final' data structure in data-final-fixes

KiwiHawk commented 2 years ago

I am still of the opinion that the angelsdev-unit-test can take the role as the one loading last.

As long as we only use optional dependencies, that should be okay with me. I want to be able to run the unit tests against other mod packs, not just Angel's.

LovelySanta commented 2 years ago

As long as we only use optional dependencies

Ofc it would be optional (and hidden) (?)