From 0a5bb0d0151f1a1a6f2495bf5e7d01aa4f2762b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tam=C3=A1s=20K=2E=20Papp?= Date: Tue, 9 Apr 2024 14:59:47 +0200 Subject: [PATCH 1/3] Change tests so that we test our own implementations only. Bugs in wrappers do not break our code tests then. Cf #199. --- julia-mode-tests.el | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/julia-mode-tests.el b/julia-mode-tests.el index 45db3c7..0fd4d21 100644 --- a/julia-mode-tests.el +++ b/julia-mode-tests.el @@ -64,7 +64,7 @@ "Assert that TEXT at position POS gets font-locked with FACE in `julia-mode'." `(should (eq ,face (julia--get-font-lock ,text ,pos)))) -(defun julia--should-move-point-helper (text fun from to &optional end arg) +(defun julia--should-move-point-helper (text fun from to &optional end &rest args) "Takes the same arguments as `julia--should-move-point', returns a cons of the expected and the actual point." (with-temp-buffer (julia-mode) @@ -74,25 +74,26 @@ (if (stringp from) (re-search-forward from) (goto-char from)) - (funcall fun arg) + (apply fun args) (let ((actual-to (point)) (expected-to (if (stringp to) (progn (goto-char (point-min)) (re-search-forward to) - (if end (goto-char (match-end 0)) + (if end + (goto-char (match-end 0)) (goto-char (match-beginning 0)) (point-at-bol))) to))) (cons expected-to actual-to)))) -(defmacro julia--should-move-point (text fun from to &optional end arg) +(defmacro julia--should-move-point (text fun from to &optional end &rest args) "With TEXT in `julia-mode', after calling FUN, the point should move FROM\ to TO. If FROM is a string, move the point to matching string before calling function FUN. If TO is a string, match resulting point to point a beginning of matching line or end of match if END is non-nil. Optional ARG is passed to FUN." (declare (indent defun)) - `(let ((positions (julia--should-move-point-helper ,text ,fun ,from ,to ,end ,arg))) + `(let ((positions (julia--should-move-point-helper ,text ,fun ,from ,to ,end ,@args))) (should (eq (car positions) (cdr positions))))) ;;; indent tests @@ -892,10 +893,10 @@ return n * fact(n-1) end end return fact(x) -end" 'end-of-defun "n == 0" "end[ \n]+end\n" 'end)) +end" 'julia-end-of-defun "function fact(n)" "end[ \n]+end" 'end)) (ert-deftest julia--test-end-of-defun-nested-2 () - "Point should move to end of outer function when called from inner with prefix." + "Point should move to end of outer function when called from outer." (julia--should-move-point "function f(x) function fact(n) @@ -906,7 +907,7 @@ return n * fact(n-1) end end return fact(x) -end" 'end-of-defun "n == 0" "return fact(x)[ \n]+end" 'end 2)) +end" 'julia-end-of-defun "function f(x)" "return fact(x)[ \n]+end" 'end)) ;;; ;;; latex completion tests From fecfe2092715b7b89590d77bdc70f2a0386ce19f Mon Sep 17 00:00:00 2001 From: "Tamas K. Papp" Date: Fri, 3 May 2024 15:14:49 +0200 Subject: [PATCH 2/3] Update julia-mode-tests.el Co-authored-by: Felipe Lema --- julia-mode-tests.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/julia-mode-tests.el b/julia-mode-tests.el index 0fd4d21..e1d2129 100644 --- a/julia-mode-tests.el +++ b/julia-mode-tests.el @@ -80,7 +80,7 @@ (if (stringp to) (progn (goto-char (point-min)) (re-search-forward to) - (if end + (when end (goto-char (match-end 0)) (goto-char (match-beginning 0)) (point-at-bol))) From eadbdbe1dedd15d71cea5e1f5f4f066aa468fc9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tam=C3=A1s=20K=2E=20Papp?= Date: Mon, 6 May 2024 14:02:35 +0200 Subject: [PATCH 3/3] Revert "Update julia-mode-tests.el" This reverts commit fecfe2092715b7b89590d77bdc70f2a0386ce19f. --- julia-mode-tests.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/julia-mode-tests.el b/julia-mode-tests.el index e1d2129..0fd4d21 100644 --- a/julia-mode-tests.el +++ b/julia-mode-tests.el @@ -80,7 +80,7 @@ (if (stringp to) (progn (goto-char (point-min)) (re-search-forward to) - (when end + (if end (goto-char (match-end 0)) (goto-char (match-beginning 0)) (point-at-bol)))