1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2025-11-01 06:03:00 +00:00

Move some test support code into testFixtues

This offers very few advantages now, but helps support the following in
the future:

 - Reuse test support code across multiple projects (useful for
   multi-loader).
 - Allow using test fixture code in testMod. We've got a version of our
   gametest which use Kotlin instead of Lua for asserting computer
   behaviour.

We can't use java-test-fixtures here for Forge reasons, so have to roll
our own version. Alas.

 - Add an ILuaMachine implementation which runs Kotlin coroutines
   instead. We can use this for testing asynchronous APIs. This also
   replaces the FakeComputerManager.

 - Move most things in the .support module to .test.core. We need to use
   a separate package in order to cope with Java 9 modules (again,
   thanks Forge).
This commit is contained in:
Jonathan Coates
2022-10-29 18:17:02 +01:00
parent 1e88d37004
commit 71f81e1201
32 changed files with 745 additions and 427 deletions

View File

@@ -5,6 +5,7 @@
*/
package dan200.computercraft.core.computer;
import com.google.common.annotations.VisibleForTesting;
import com.google.errorprone.annotations.concurrent.GuardedBy;
import dan200.computercraft.ComputerCraft;
import dan200.computercraft.core.ComputerContext;
@@ -443,7 +444,8 @@ public final class ComputerThread
*
* @return If we have work queued up.
*/
boolean hasPendingWork()
@VisibleForTesting
public boolean hasPendingWork()
{
// FIXME: See comment in scaledPeriod. Again, we access this in multiple threads but not clear if it matters!
return !computerQueue.isEmpty();