catala/tests/test_scope/bad/cycle_in_scope.catala_en
Louis Gesbert 0ab7a0f9ce Turn all existing tests to inline tests
Done using
```bash
process() { FILE=$1; awk 'match($0, /^```catala-test *{ *id *= *"(.*)" *}/, a) {print "```catala-test-inline"; f="'"$(dirname $FILE)/output/$(basename $FILE)"'." a[1]; getline; print "$ " $0; while ((getline<f) > 0) print; next} {print}' $FILE >$FILE.new; mv $FILE.new $FILE; }
for f in tests/test_*/*/*.catala_* examples/**/*.catala_*; do process $f; git add $f; done
for d in $(find -name output -type d); do git rm -r $d; done
```
2022-09-23 14:45:10 +02:00

63 lines
1.6 KiB
Plaintext

## Article
```catala
declaration scope A:
context x content integer
context y content integer
context z content integer
scope A:
definition y under condition x < 0 consequence equals - x
definition y under condition x >= 0 consequence equals x
definition z under condition y >= 1 consequence equals 10 / y
definition z under condition y < 1 consequence equals y
definition x equals z
```
```catala-test-inline
$ catala Interpret -s A
[ERROR] Cyclic dependency detected between variables of scope A!
Cycle variable z, declared:
--> tests/test_scope/bad/cycle_in_scope.catala_en
|
7 | context z content integer
| ^
+ Article
Used here in the definition of another cycle variable x:
--> tests/test_scope/bad/cycle_in_scope.catala_en
|
14 | definition x equals z
| ^
+ Article
Cycle variable y, declared:
--> tests/test_scope/bad/cycle_in_scope.catala_en
|
6 | context y content integer
| ^
+ Article
Used here in the definition of another cycle variable z:
--> tests/test_scope/bad/cycle_in_scope.catala_en
|
13 | definition z under condition y < 1 consequence equals y
| ^
+ Article
Cycle variable x, declared:
--> tests/test_scope/bad/cycle_in_scope.catala_en
|
5 | context x content integer
| ^
+ Article
Used here in the definition of another cycle variable y:
--> tests/test_scope/bad/cycle_in_scope.catala_en
|
11 | definition y under condition x >= 0 consequence equals x
| ^
+ Article
```