catala/tests
2021-06-21 11:39:06 +02:00
..
test_arithmetic/bad fix(compiler): refactor and fix the duration division operator evaluation 2021-05-31 10:42:20 +02:00
test_array refactor(tests)!: migrate test file from the abbreviated syntax to the english one 2021-05-26 21:16:29 +02:00
test_bool refactor(tests)!: migrate test file from the abbreviated syntax to the english one 2021-05-26 21:16:29 +02:00
test_date feat(compiler): add the Runtime.IndivisableDurations exception handling 2021-05-31 10:26:51 +02:00
test_dec/good fix(tests): add test case for the good utilisation of the duration division operator 2021-05-31 10:26:51 +02:00
test_default/bad refactor(tests)!: migrate test file from the abbreviated syntax to the english one 2021-05-26 21:16:29 +02:00
test_enum refactor(compiler): unreachable match case error change to warning 2021-06-03 16:43:04 +02:00
test_exception refactor(tests)!: migrate test file from the abbreviated syntax to the english one 2021-05-26 21:16:29 +02:00
test_func refactor(tests)!: migrate test file from the abbreviated syntax to the english one 2021-05-26 21:16:29 +02:00
test_literate/good fix: update all syntax highlighting in order to match widlcard keywords 2021-06-03 15:33:40 +02:00
test_money refactor(tests)!: migrate test file from the abbreviated syntax to the english one 2021-05-26 21:16:29 +02:00
test_name_resolution/good refactor(tests)!: migrate test file from the abbreviated syntax to the english one 2021-05-26 21:16:29 +02:00
test_scope refactor(tests)!: migrate test file from the abbreviated syntax to the english one 2021-05-26 21:16:29 +02:00
test_struct refactor(tests)!: migrate test file from the abbreviated syntax to the english one 2021-05-26 21:16:29 +02:00
Makefile Big renaming and dir reorg 2021-06-21 11:39:06 +02:00
README.md docs(test): update the README.md 2021-05-26 21:57:51 +02:00

Catala test suite

This folder contains Catala source files designed to test the features of the language.

It uses make pass_tests to launch tests and compare the test terminal output with an expected output.

Expected outputs are stored using the convention <name_of_test>.catala_<language>.<name_of_scope>.out in the corresponding test output folder.

For both workflows: use CATALA_OPTS="..." make ... to pass in Catala compiler options when debugging.

Workflow for adding new tests

  1. Create a new test file in foo/{good,bad}/bar.catala_<language> (pick the right directory and an informative name for your test)
  2. Write your test, and pick a toplevel scope A to run.
  3. From this directory, launch make foo/{good,bad}/bar.catala_<language>.A.run to get the output of your test.
  4. When you're happy with the output, launch make foo/{good,bad}/bar.catala_<language>.A.in. This will record the content of the output of your test into a file.
  5. Check that your test pass with make foo/{good,bad}/output/bar.catala_<language>.A.out.
  6. That's it, you've added a new test for the Catala language!

Workflow for fixing regressions

  1. Run make, if a test fails you should see something like [FAIL foo/{good,bad}/output/bar.catala_<language>.A].
  2. Compare the computed and expected output with make foo/{good,bad}/output/bar.catala_<language>.A.out.
  3. Debug the compiler and/or the test, running make foo/{good,bad}/bar.catala_<language>.A.run periodically to check the output of Catala on the test case.
  4. When you're finished debugging, record the new test output with make foo/{good,bad}/bar.catala_<language>.A.in.
  5. Re-run make to check that everything passes.
  6. That's it, you've fixed the Catala test suite to adapt for changes in the language.

If a compiler change causes a lot of regressions (error message formatting changes for instance), you can mass-reset the expected the outputs with make reset_tests. Caution: use at your own risk, regressions should be fixed one by one in general.