From: Eshel Yaron Date: Sun, 27 Nov 2022 19:34:32 +0000 (+0200) Subject: Add test for predicate completion with named arguments X-Git-Tag: V9.1.0-sweep-0.9.3~1 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=6e3bf5c9965b34115f23e3578abd7a81df324e67;p=dict.git Add test for predicate completion with named arguments --- diff --git a/README.org b/README.org index 244528f..a289c99 100644 --- a/README.org +++ b/README.org @@ -1648,11 +1648,6 @@ there some further improvements that we want to pursue: definition, ideally with optional =PlDoc= comments (see [[#sweeprolog-pldoc][Documenting predicates]]). -- Improve the information provided for predicate completion candidates :: predicate - completion with ~C-M-i~ should annotate each completion candidate with - the names and modes of its arguments, when available. E.g. say - ~foo(+Bar, -Baz)~ instead of ~foo/2~. - - Make predicate completion aware of module-qualification :: predicate completion should detect when the prefix it's trying to complete starts with a module-qualification ~foo:ba<|>~ and restrict completion diff --git a/sweeprolog-tests.el b/sweeprolog-tests.el index 1830681..8732098 100644 --- a/sweeprolog-tests.el +++ b/sweeprolog-tests.el @@ -262,6 +262,38 @@ foo => barbaz(_, _)" )))) +(ert-deftest complete-predicate-with-args () + "Tests completing predicate calls." + (let ((temp (make-temp-file "sweeprolog-test" + nil + ".pl" + " +:- module(foobarbaz, []). + +%! foobarbaz(:Bar, ?Baz:integer) is det. + +foobarbaz(_, 5) :- spam. + +spam :- foobarb +" + ))) + (find-file-literally temp) + (sweeprolog-mode) + (goto-char (point-max)) + (backward-char) + (call-interactively #'completion-at-point) + (should (string= (buffer-string) + " +:- module(foobarbaz, []). + +%! foobarbaz(:Bar, ?Baz:integer) is det. + +foobarbaz(_, 5) :- spam. + +spam :- foobarbaz(Bar, Baz) +" + )))) + (ert-deftest complete-predicate () "Tests completing predicate calls." (let ((temp (make-temp-file "sweeprolog-test"