Plunit and optimise

With this program:

:- set_prolog_flag(optimise, true).

:- begin_tests(foo).

test(1) :-
   true.

:- end_tests(foo).

compiling the buffer works fine (Ctrl-c Ctrl-b) but make/0 (Ctrl-c Ctrl-m) gives an error:

% /home/mike/odds_and_sods/test compiled 0.00 sec, 0 clauses
|    ERROR: plunit:current_test/5: Unknown procedure: plunit_foo:'unit test'/4
ERROR: Unknown procedure: plunit_foo:'unit test'/4
ERROR: In:
ERROR:   [15] throw(error(existence_error(procedure,...),context(...,_2108)))
ERROR:   [13] read_term_with_history(_2132,[show(h),...|...]) at /home/mike/lib/swipl/boot/history.pl:55
ERROR:   [11] call_cleanup('$toplevel':read_query('~! ?- ',_2188,_2190),'$toplevel':end_input_style) at /home/mike/lib/swipl/boot/init.pl:685
ERROR:   [10] catch('$toplevel':call_cleanup(...,end_input_style),error(io_error(_2246,_2248),_2242),'$toplevel':fail) at /home/mike/lib/swipl/boot/init.pl:565

Fixed as well by AI. I really love it for bug reports you copy/paste the URLs, wait a little and all is diagnosed and in well over 90% of the cases properly fixed :slight_smile: Only occasionally I have to correct that the suggested patch works, but is a step in the wrong direction and the bug should be fixed otherwise.