More precise pattern matching when looking for source file in test framework

This commit is contained in:
Aymeric Fromherz 2021-01-23 20:57:31 -05:00
parent 5823c2ec3f
commit e63bdf0634
6 changed files with 29 additions and 21 deletions

View File

@ -34,8 +34,8 @@ reset_tests: $(subst .out,.in,$(wildcard */output/*.out))
# <test_dir>/output/<test_name>.catala.<scope_name>.out
%.out: .FORCE
@$(CATALA) --unstyled $(wildcard \
$(word 1, $(subst /, , $*))/good/$(word 1, $(subst ., ,$(word 3, $(subst /, , $*))))* \
$(word 1, $(subst /, , $*))/bad/$(word 1, $(subst ., ,$(word 3, $(subst /, , $*))))*) \
$(word 1, $(subst /, , $*))/good/$(word 1, $(subst ., ,$(word 3, $(subst /, , $*)))).catala* \
$(word 1, $(subst /, , $*))/bad/$(word 1, $(subst ., ,$(word 3, $(subst /, , $*)))).catala*) \
-s $(word 3, $(subst ., ,$*)) 2>&1 | \
colordiff -u -b $@ - || { echo "${RED}FAIL${RESET} ${PURPLE}$*${RESET}"; exit 1; }
@echo "${GREEN}PASS${RESET} ${PURPLE}$*${RESET}"
@ -45,11 +45,11 @@ reset_tests: $(subst .out,.in,$(wildcard */output/*.out))
# writes this output to the <test_dir>/output/<test_name>.catala.<scope_name>.out file
%.in: .FORCE
@-$(CATALA) $(wildcard \
$(word 1, $(subst /, , $*))/good/$(word 1, $(subst ., ,$(word 3, $(subst /, , $*))))* \
$(word 1, $(subst /, , $*))/bad/$(word 1, $(subst ., ,$(word 3, $(subst /, , $*))))*) \
$(word 1, $(subst /, , $*))/good/$(word 1, $(subst ., ,$(word 3, $(subst /, , $*)))).catala* \
$(word 1, $(subst /, , $*))/bad/$(word 1, $(subst ., ,$(word 3, $(subst /, , $*)))).catala*) \
-s $(word 3, $(subst ., ,$*))
@-$(CATALA) --unstyled $(wildcard \
$(word 1, $(subst /, , $*))/good/$(word 1, $(subst ., ,$(word 3, $(subst /, , $*))))* \
$(word 1, $(subst /, , $*))/bad/$(word 1, $(subst ., ,$(word 3, $(subst /, , $*))))*) \
$(word 1, $(subst /, , $*))/good/$(word 1, $(subst ., ,$(word 3, $(subst /, , $*)))).catala* \
$(word 1, $(subst /, , $*))/bad/$(word 1, $(subst ., ,$(word 3, $(subst /, , $*)))).catala*) \
-s $(word 3, $(subst ., ,$*)) \
> $(word 1, $(subst /, , $*))/output/$(word 3, $(subst /, , $*)).out 2>&1

View File

@ -1,3 +1,2 @@
catala: too many arguments, don't know what to do with `test_array/good/aggregation_2.catala'
Usage: catala [OPTION]... BACKEND FILE
Try `catala --help' for more information.
[RESULT] Computation successful! Results:
[RESULT] x = [$0.00; $9.00; $5.20]

View File

@ -1,3 +1,5 @@
catala: too many arguments, don't know what to do with `test_array/good/aggregation_2.catala'
Usage: catala [OPTION]... BACKEND FILE
Try `catala --help' for more information.
[RESULT] Computation successful! Results:
[RESULT] max = $18.00
[RESULT] min = $5.00
[RESULT] y = $17.20
[RESULT] z = 1

View File

@ -1,3 +1,7 @@
catala: too many arguments, don't know what to do with `test_default/bad/empty_with_rules.catala'
Usage: catala [OPTION]... BACKEND FILE
Try `catala --help' for more information.
[ERROR] This variable evaluated to an empty term (no rule that defined it applied in this situation)
[ERROR]
[ERROR] --> test_default/bad/empty.catala
[ERROR] |
[ERROR] 6 | param y content bool
[ERROR] | ^
[ERROR] + Article

View File

@ -1,3 +1,2 @@
catala: too many arguments, don't know what to do with `test_exception/good/exceptions_squared.catala', `test_exception/bad/exceptions_cycle.catala'
Usage: catala [OPTION]... BACKEND FILE
Try `catala --help' for more information.
[RESULT] Computation successful! Results:
[RESULT] x = 1

View File

@ -1,3 +1,7 @@
catala: too many arguments, don't know what to do with `test_struct/bad/nested2.catala', `test_struct/bad/nested.catala'
Usage: catala [OPTION]... BACKEND FILE
Try `catala --help' for more information.
[ERROR] The type S is defined using itself, which is forbidden since Catala does not provide recursive types
[ERROR]
[ERROR] --> test_struct/bad/nested.catala
[ERROR] |
[ERROR] 5 | data x content S
[ERROR] | ^
[ERROR] + Article