Creates basic test runner script for Windows

This commit is contained in:
Tim Dévé 2020-04-06 16:36:42 +01:00 committed by Tim Deve
parent 84403988f1
commit 0b1cb484e9

38
run_carp_tests.ps1 Normal file
View File

@ -0,0 +1,38 @@
# Stops script if there is an error
Set-StrictMode -Version Latest
$ErrorActionPreference = "Stop"
$PSDefaultParameterValues['*:ErrorAction']='Stop'
function exitOnError {
param([scriptblock]$ScriptBlock)
& @ScriptBlock
if ($lastexitcode -ne 0) {
exit $lastexitcode
}
}
# TODO Add building of examples
# Actual tests (using the test suite)
Get-ChildItem -Filter test/*.carp | ForEach-Object -Process {
exitOnError {
echo $_.FullName
stack exec carp "--" -x --log-memory $_.FullName
echo ""
}
}
# TODO Add tests for error messages
# Just make sure these compile
exitOnError { stack exec carp "--" ./examples/mutual_recursion.carp -b }
exitOnError { stack exec carp "--" ./examples/guessing.carp -b }
exitOnError { stack exec carp "--" ./examples/no_core.carp --no-core -b }
exitOnError { stack exec carp "--" ./examples/check_malloc.carp -b }
# Generate docs
exitOnError { stack exec carp "--" ./docs/core/generate_core_docs.carp }
exitOnError { stack exec carp "--" ./docs/sdl/generate_sdl_docs.carp }
echo "ALL TESTS DONE."