easier debugging of unit tests

Ross Boylan <[email protected]>
Newsgroups gmane.comp.ai.prolog.swi
Message-ID <1396375316.9858.47.camel@localhost>
A few questions.
1. guitracer. trace. run_tests('disk rules':vl1).

takes me into the debugger and I need to step through all the testing
machinery, including matching the right test, before I get to my code.
Is there a better way?

I tried putting stops on various points in 
matching_test(X, X) :- !.
matching_test(Name, Set) :-
	is_list(Set),
	memberchk(Name, Set).

and using continue to breakpoint, but this either yields the same number
of stops as before or no stops at all.  In particular, putting a stop
before the first line doesn't cause a stop.

2. Is there a way to proceed to the next line on the same level?  In
other words, given I just evaluated the first line of
pred1(A),
pred2(B, A),
pred3(C).
can I have the system evaluate pred2 without the debugger stepping into
it?

Two work-arounds are to step into pred2 and then use finish, or put a
stop before pred3 and continue to breakpoint.  I'm hoping there's a
better way.

3. Sometimes, particularly after I execute make, the tests seem to lose
the ability to see the definitions they need (both within the debugger
and doing run_tests without the debugger).  I think the problem is that
the facts it needs are inside a namespace that the test loses access to
(even though the test is in the same namespace, I think).  Is there a
solution?

The tests are in rulesTest.plt.  That program starts
:- begin_tests('disk rules').
:- ['rules.pl'].

Then it has the facts to which I lose access, and then the unit tests.

Prolog 6.4.1.

Thanks.
Ross Boylan
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.