Add (half-baked) test on module usage

Half-baked because clerk doesn't know to order the tests properly at the moment,
and we spit compiled files into the source test directory.
This commit is contained in:
Louis Gesbert 2023-08-25 15:58:04 +02:00
parent a71b4e7f73
commit b5baa91a2e
3 changed files with 47 additions and 2 deletions

View File

@ -315,10 +315,10 @@ CLERK=$(CLERK_BIN) --exe $(CATALA_BIN) \
.FORCE:
test_suite: .FORCE compiler
test_suite: .FORCE install
@$(MAKE) -C tests pass_all_tests
test_examples: .FORCE compiler
test_examples: .FORCE install
@$(MAKE) -C examples pass_all_tests
#> tests : Run interpreter tests

View File

@ -0,0 +1,22 @@
# Test modules + inclusions 1
```catala-metadata
declaration enumeration Enum1:
-- Yes
-- No
-- Maybe
declaration scope S:
output sr content money
output e1 content Enum1
```
```catala
scope S:
definition sr equals $1,000
definition e1 equals Maybe
```
```catala-test-inline
$ catala module --compile --plugin-dir=../../../_build/default/compiler/plugins --disable_warnings
```

View File

@ -0,0 +1,23 @@
# Test modules + inclusions 2
```catala
declaration scope T2:
t1 scope Mod_def.S
# input i content Enum1
output o1 content Mod_def.Enum1
output o2 content Mod_def.Enum1
output o3 content money
scope T2:
definition o1 equals Mod_def.Enum1.No
definition o2 equals t1.e1
definition o3 equals t1.sr
```
```catala-test-inline
$ catala interpret -s T2 --disable_warnings --use mod_def.catala_en
[RESULT] Computation successful! Results:
[RESULT] o1 = No ()
[RESULT] o2 = Maybe ()
[RESULT] o3 = $1,000.00
```