enu icon indicating copy to clipboard operation
enu copied to clipboard

Add unit testing infrastructure

Open dsrw opened this issue 3 weeks ago • 0 comments

Summary

  • Add three types of tests: unit tests, VM script tests, and in-world tests
  • Add nimble test command that runs all test types with proper exit codes
  • Integrate tests into CI workflows (macOS and Windows get world tests, Linux skips due to server build)

Changes

Test Infrastructure

  • Unit tests (tests/unit/) - test ScriptCtx, serializers without Godot
  • VM tests (tests/vm/) - test vmlib API via command-line script execution
  • In-world tests (vmlib/worlds/tests/) - tests that run inside Enu

Command Line Flags

  • --level-dir <path> - load specific level directory
  • --enu-test - enable test mode (auto-exit when scripts finish)

New API

  • has_block_at(position) - check if block exists at world position
  • block_color_at(position) - get color of block at world position

Bug Fixes

  • Fixed voxel lookup to also check batched voxels during script execution

Known Bugs (documented with commented-out tests)

  • left/right/up/down in move mode all move in forward direction

Test plan

  • [x] nimble unit_tests passes
  • [x] nimble vm_tests passes
  • [x] nimble world_tests passes
  • [x] nimble test runs all three and reports correctly

dsrw avatar Dec 11 '25 13:12 dsrw