-
I was unable to find a unit test library that works with Scryer Prolog, so I created my own. It's very basic, but seems reasonable to me. I'd love to get some feedback on it. I am fairly new to Prolog and am definitely open to suggestions on what could be improved, including naming conventions. See https://github.com/mvolkmann/prolog-modules. The file The output from running the tests should be "All 7 tests passed".
|
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 9 replies
-
There's always a place for light unit test tools. For a full featured one that supports Scryer Prolog, see: Overview - https://logtalk.org/tools.html#testing |
Beta Was this translation helpful? Give feedback.
-
@pmoura My current lightweight test module requires that I pass it a list of test predicates to execute. I have to prefix each one with |
Beta Was this translation helpful? Give feedback.
-
@pmoura I updated https://github.com/mvolkmann/prolog-modules/blob/10ca779d9794949ec6e1f3091bffddf503224a50/unit_test.pl#L11 to define an |
Beta Was this translation helpful? Give feedback.
Given that
strings.plt
is a plain Prolog file (i.e. it doesn't define a module), its default namespace (when consulted) is alreadyuser
. To avoid the explicit prefixing of the test predicates, therun_tests/1
would be declared as a meta-predicate. But its argument is not a goal or a closure but a list of closures. That means using:However, this will not work as you would get a qualified list:
which will make the
foldl/4
goal fail as it expects a list in the secon…