Jakttest is the test driver we use to test the Jakt compiler with code snippets. It's also written in Jakt.
To build Jakttest you should use the ninja
build system which will use the provided build.ninja
file.
It needs the same clang++
that is required to build any other Jakt file, and python
3.6+ to run the
patch script that patches the generated C++ from Jakt code to accept the external C++ code.
As a list:
ninja
(orninja-build
on some package managers)clang++
First, make sure that you have the generated build directory:
cmake -GNinja -B build -S .
Now make sure jakttest
is built:
ninja -C build jakttest
To run the tests, just use the binary:
./build/bin/jakttest
Jakttest has some options you can pass to it to customize certain behaviors (number of jobs, temporary directory to use...) that are set to reasonable defaults, but you can always customize it. To see them all, check the output of:
./build/bin/jakttest -h
Most tests you'll se have a little comment at the top, with three slashes:
/// Expect:
/// - <tag>: "<escaped output>"
There are currently three available tags:
output
: Expects the test to compile, succeed execution and output to standard output.stderr
: Expects the test to compile, but execution fails and output is written to standard error.error
: Expects the test to be rejected by the Jakt compiler, where the given output must appear somewhere in its error output.