2017-09-08 13:24:57 +03:00
|
|
|
#!/bin/bash
|
|
|
|
|
2017-11-22 14:42:32 +03:00
|
|
|
set -e; # will make the script stop if there are any errors
|
2018-05-19 07:48:41 +03:00
|
|
|
set -u; # will make the script stop if there is use of undefined
|
|
|
|
|
|
|
|
NO_SDL=0
|
|
|
|
if [[ $# -gt 0 ]] && [[ "$1" == "--no_sdl" ]]; then
|
|
|
|
NO_SDL=1
|
|
|
|
fi
|
2017-11-22 14:42:32 +03:00
|
|
|
|
2017-09-08 13:24:57 +03:00
|
|
|
stack build;
|
2018-05-23 11:32:13 +03:00
|
|
|
# This is useful for devs, but these tests should not rely on `carp` being in
|
|
|
|
# PATH.
|
|
|
|
stack install;
|
2017-09-08 13:24:57 +03:00
|
|
|
|
2017-12-23 10:33:13 +03:00
|
|
|
# Build and run some examples
|
2018-09-21 15:42:55 +03:00
|
|
|
./test/execute.sh ./examples/basics.carp
|
|
|
|
./test/execute.sh ./examples/functor.carp
|
|
|
|
./test/execute.sh ./examples/external_struct.carp
|
|
|
|
./test/execute.sh ./examples/updating.carp
|
|
|
|
./test/execute.sh ./examples/sorting.carp
|
|
|
|
./test/execute.sh ./examples/globals.carp
|
|
|
|
./test/execute.sh ./examples/generic_structs.carp
|
|
|
|
./test/execute.sh ./examples/setting_variables.carp
|
|
|
|
./test/execute.sh ./examples/function_members.carp
|
|
|
|
./test/execute.sh ./examples/map.carp
|
2018-09-25 16:59:55 +03:00
|
|
|
./test/execute.sh ./examples/lambdas.carp
|
2017-12-21 19:11:43 +03:00
|
|
|
|
2018-01-15 19:28:19 +03:00
|
|
|
# Actual tests (using the test suite)
|
|
|
|
for f in ./test/*.carp; do
|
2018-02-06 10:21:50 +03:00
|
|
|
echo $f
|
2018-05-19 06:40:18 +03:00
|
|
|
stack exec carp -- -x --log-memory $f
|
2018-02-05 20:59:47 +03:00
|
|
|
echo
|
2018-01-15 19:28:19 +03:00
|
|
|
done
|
2017-11-21 13:53:32 +03:00
|
|
|
|
2018-09-21 15:42:55 +03:00
|
|
|
# Test for correct error messages when doing "carp --check" on the source.
|
|
|
|
for f in ./test-for-errors/*.carp; do
|
|
|
|
echo $f
|
|
|
|
./test/check.sh $f
|
|
|
|
echo
|
|
|
|
done
|
|
|
|
|
2017-12-23 10:33:13 +03:00
|
|
|
# Just make sure these compile
|
2018-05-19 06:40:18 +03:00
|
|
|
stack exec carp -- ./examples/mutual_recursion.carp -b
|
|
|
|
stack exec carp -- ./examples/guessing.carp -b
|
|
|
|
stack exec carp -- ./examples/no_core.carp --no-core -b
|
2017-12-14 00:09:12 +03:00
|
|
|
|
2018-05-19 07:48:41 +03:00
|
|
|
# Run tests which rely on SDL unless the `--no_sdl` argument was passed in
|
|
|
|
if [[ ${NO_SDL} -eq 0 ]]; then
|
|
|
|
stack exec carp -- ./examples/ant.carp -b
|
|
|
|
stack exec carp -- ./examples/reptile.carp -b
|
|
|
|
stack exec carp -- ./examples/game.carp -b
|
|
|
|
stack exec carp -- ./examples/minimal_sdl.carp -b
|
|
|
|
stack exec carp -- examples/sounds.carp -b
|
|
|
|
stack exec carp -- examples/fonts.carp -b
|
|
|
|
fi
|
|
|
|
|
2018-03-27 11:52:17 +03:00
|
|
|
# Generate core docs
|
2018-05-19 06:40:18 +03:00
|
|
|
stack exec carp -- ./docs/core/generate_core_docs.carp -b
|
2018-03-27 11:52:17 +03:00
|
|
|
|
2017-12-14 00:09:12 +03:00
|
|
|
echo "ALL TESTS DONE."
|