One of the reasons to have tests is to simplify migrating code between Prolog implementations. Unfortunately creating a portable test-suite implies a poor integration into the development environment. Luckily, the specification of the test-system proposed here can be ported quite easily to most Prolog systems sufficiently compatible to SWI-Prolog to consider porting your application. Most important is to have support for term_expansion/2.
In the current system, test units are compiled into sub-modules of the module in which they appear. Few Prolog systems allow for sub-modules and therefore ports may have to fall-back to inject the code in the surrounding module. This implies that support predicates used inside the test unit should not conflict with predicates of the module being tested.
The directory of plunit.pl
and swi.pl
must
be in the
library
search-path. With PLUNITDIR replaced accordingly,
add the following into your .sicstusrc
or sicstus.ini
.
:- set_prolog_flag(language, iso). % for maximal compatibility library_directory('PLUNITDIR').
The current version runs under SICStus 3. Open issues:
plunit.pl
. Both coverage analysis and the test
generation wizard currently require SWI-Prolog.
load
option normal
is the same as always
.
Use set_test_options(load, never)
to avoid loading the test
suites.
run
option is not supported.