foo :- Body.
"))))
-(ert-deftest dwim-next-clause-module-qualified-cdg ()
+(ert-deftest dwim-next-clause-module-qualified-dcg ()
"Tests inserting new module-qualified DCG non-terminal."
(let ((temp (make-temp-file "sweeprolog-test"
nil
(sweeprolog-end-of-top-term)
(should (= (point) 252))))
+(ert-deftest beginning-of-predicate-definition-near-bob ()
+ "Test finding the beginning of the first predicate definition."
+ (with-temp-buffer
+ (sweeprolog-mode)
+ (insert "foo :- bar.")
+ (goto-char (point-min))
+ (sweeprolog-beginning-of-predicate-at-point)
+ (should (= (point) (point-min)))))
+
(ert-deftest align-spacs-in-line-comment ()
"Test using `sweeprolog-align-spaces' in a line comment."
(with-temp-buffer
(while (and point (not (bobp)))
(sweeprolog-beginning-of-top-term)
(backward-char 1)
- (if-let* ((ndef (sweeprolog-definition-at-point (point)))
+ (if-let* ((moved (< (point) point))
+ (ndef (sweeprolog-definition-at-point (point)))
(nfun (cadr ndef))
(nari (caddr ndef))
(same (and (string= fun nfun)