Term expansion of test/1 clauses doesn’t seem to work when they are included in a main test file through include/1.
I don’t know if this is expected, but I would have guessed that include/1 would not change things regarding the expansion of terms here.
Simple example:
File: main.pl
:- begin_tests(main).
:- include(some_tests).
test(a) :- a == a.
:- end_tests(main).
I’m creating batches of test clauses automatically from data residing in another data source, both to enable collaborators to add test cases without knowing Prolog and to help with refactoring in case some core predicates used in these tests change (in their use or definition).
Apart from my use case, which may be specific, perhaps included files should be dealt with for a matter of consistency/expectation?
Thanks for the answer and confirmation.
I pushed a patch that solves this partially. Including tests works. If the test fails it is reported against the line of the included file but the file is the main file. Fixing that requires getting the right file through the registration and reporting. If anyone cares, please submit a patch. I guess the idea would be to pass in Line a term File:Line, either always or only if the test comes from an included file.