mirror of
https://github.com/CatalaLang/catala.git
synced 2024-11-09 01:35:56 +03:00
.. | ||
test_bool | ||
test_date | ||
test_dec | ||
test_default | ||
test_enum | ||
test_func | ||
test_money | ||
test_scope | ||
test_struct | ||
Makefile | ||
README.md |
Catala test suite
This folder contains Catala source files designed to test the features of the language.
It uses make
to launch tests and compare the test terminal output with an expected output.
When you create a new test, please register it in the Makefile
following the other examples. Expected outputs are stored using the convention <name_of_test>.catala.<name_of_scope>.out
in the corresponding test folder.
For both workflows: use CATALA_OPTS="..." make ...
to pass in Catala compiler
options when debugging.
Workflow for adding new tests
- Create a new test file in
foo/bar.catala
(pick the right directory and an informative name for your test) - Write your test, and pick a toplevel scope
A
to run. - From this directory, launch
make foo/bar.catala.A.run
to get the output of your test. - When you're happy with the output, launch
make foo/bar.catala.A.in
. This will record the content of the output of your test into a file. - Check that your test pass with
make foo/bar.catala.A.out
. - That's it, you've added a new test for the Catala language!
Workflow for fixing regressions
- Run
make
, if a test fails you should see something like[FAIL foo/bar.catala.A]
. - Compare the computed and expected output with
make foo/bar.catala.A.out
. - Debug the compiler and/or the test, running
make foo/bar.catala.A.run
periodically to check the output of Catala on the test case. - When you're finished debugging, record the new test output with
make foo/bar.catala.A.in
. - Re-reun
make
to check that everything passes. - That's it, you've fixed the Catala test suite to adapt for changes in the language.