In working on a patch for ffi, I am running into the following problem using term_expansion/2 within plunit tests:
:- module(a,[]).
system:term_expansion(T, (H :- R=4) ) :-
nonvar(T),
% Simply expand terms of the form texp(R)
T = (H :- texp(R)).
t(R) :-
texp(R).
:- begin_tests(t).
test(expansion,R=4) :-
texp(R).
test(noexpansion,R=5) :-
R=5.
:- end_tests(t).
Query:
1 ?- run_tests.
% PL-Unit: t . done
% test passed
true.
2 ?- listing(plunit_t:_).
'unit body'('noexpansion@line 18', vars(R)) :-
!,
R=5.
test(expansion, R=4) :-
R=4.
'unit test'(noexpansion, 18, [true(A=5)], plunit_t:'unit body'('noexpansion@line 18', vars(A))).
true.
As you can see only test(noexpansion,R=5)
is run. The test with the term expansion is skipped. Any workarounds or am I missing something?