Files
MusicPlayer/addons/gdUnit4/runtest.cmd
T
Sansan c985a6ce5b Replace the broken test suite with working GdUnit4 tests
The previous tests never compiled: they used GUT's assert functions,
Godot 3 APIs and reassigned autoload functions, so no test ran.

- 90 tests: unit tests for the playlist, songs, player scoring, time
  formatting, search and the server client, plus integration tests
  that run MainWindow and SyncWindow against a fake server
- Keybind tests check that Alt+<number> and Ctrl+Alt+<number> keep
  following the player rows while players are added and removed
- run_tests.sh finds Godot and runs the suite headless (~10 seconds)
- CI runs the tests before the build job in gitea-build.yaml; the
  separate test.yml used a GitHub action that does not exist
- GdUnit4 is committed instead of ignored, since the project enables
  it, and .gitea/ is no longer ignored
- Exported builds leave out tests/ and addons/gdUnit4/
2026-10-06 08:32:56 +02:00

66 lines
2.0 KiB
Batchfile

@echo off
setlocal enabledelayedexpansion
:: Initialize variables
set "godot_binary="
set "filtered_args="
:: Process all arguments
set "i=0"
:parse_args
if "%~1"=="" goto end_parse_args
if "%~1"=="--godot_binary" (
set "godot_binary=%~2"
shift
shift
) else (
set "filtered_args=!filtered_args! %~1"
shift
)
goto parse_args
:end_parse_args
:: If --godot_binary wasn't provided, fallback to environment variable
if "!godot_binary!"=="" (
set "godot_binary=%GODOT_BIN%"
)
:: Check if we have a godot_binary value from any source
if "!godot_binary!"=="" (
echo Godot binary path is not specified.
echo Please either:
echo - Set the environment variable: set GODOT_BIN=C:\path\to\godot.exe
echo - Or use the --godot_binary argument: --godot_binary C:\path\to\godot.exe
exit /b 1
)
:: Check if the Godot binary exists
if not exist "!godot_binary!" (
echo Error: The specified Godot binary '!godot_binary!' does not exist.
exit /b 1
)
:: Get Godot version and check if it's a mono build
for /f "tokens=*" %%i in ('"!godot_binary!" --version') do set GODOT_VERSION=%%i
echo !GODOT_VERSION! | findstr /I "mono" >nul
if !errorlevel! equ 0 (
echo Godot .NET detected
echo Compiling c# classes ... Please Wait
dotnet build --debug
echo done !errorlevel!
)
:: Run the tests with the filtered arguments.
:: --remote-debug tcp://127.0.0.1:0 prevents Godot from activating its local interactive
:: CLI debugger, which would cause an endless 'debug>' loop on script parse errors.
:: Port 0 is used intentionally as it is never bound, so the connection is always refused.
"!godot_binary!" --path . -s -d --remote-debug tcp://127.0.0.1:0 res://addons/gdUnit4/bin/GdUnitCmdTool.gd !filtered_args!
set exit_code=%ERRORLEVEL%
echo Run tests ends with %exit_code%
:: Run the copy log command
"!godot_binary!" --headless --path . --quiet -s res://addons/gdUnit4/bin/GdUnitCopyLog.gd !filtered_args! > nul
set exit_code2=%ERRORLEVEL%
exit /b %exit_code%