Skip to content

Commit 0a5bb0d

Browse files
committed
Change tests so that we test our own implementations only.
Bugs in wrappers do not break our code tests then. Cf #199.
1 parent c19d10e commit 0a5bb0d

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

julia-mode-tests.el

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
"Assert that TEXT at position POS gets font-locked with FACE in `julia-mode'."
6565
`(should (eq ,face (julia--get-font-lock ,text ,pos))))
6666

67-
(defun julia--should-move-point-helper (text fun from to &optional end arg)
67+
(defun julia--should-move-point-helper (text fun from to &optional end &rest args)
6868
"Takes the same arguments as `julia--should-move-point', returns a cons of the expected and the actual point."
6969
(with-temp-buffer
7070
(julia-mode)
@@ -74,25 +74,26 @@
7474
(if (stringp from)
7575
(re-search-forward from)
7676
(goto-char from))
77-
(funcall fun arg)
77+
(apply fun args)
7878
(let ((actual-to (point))
7979
(expected-to
8080
(if (stringp to)
8181
(progn (goto-char (point-min))
8282
(re-search-forward to)
83-
(if end (goto-char (match-end 0))
83+
(if end
84+
(goto-char (match-end 0))
8485
(goto-char (match-beginning 0))
8586
(point-at-bol)))
8687
to)))
8788
(cons expected-to actual-to))))
8889

89-
(defmacro julia--should-move-point (text fun from to &optional end arg)
90+
(defmacro julia--should-move-point (text fun from to &optional end &rest args)
9091
"With TEXT in `julia-mode', after calling FUN, the point should move FROM\
9192
to TO. If FROM is a string, move the point to matching string before calling
9293
function FUN. If TO is a string, match resulting point to point a beginning of
9394
matching line or end of match if END is non-nil. Optional ARG is passed to FUN."
9495
(declare (indent defun))
95-
`(let ((positions (julia--should-move-point-helper ,text ,fun ,from ,to ,end ,arg)))
96+
`(let ((positions (julia--should-move-point-helper ,text ,fun ,from ,to ,end ,@args)))
9697
(should (eq (car positions) (cdr positions)))))
9798

9899
;;; indent tests
@@ -892,10 +893,10 @@ return n * fact(n-1)
892893
end
893894
end
894895
return fact(x)
895-
end" 'end-of-defun "n == 0" "end[ \n]+end\n" 'end))
896+
end" 'julia-end-of-defun "function fact(n)" "end[ \n]+end" 'end))
896897

897898
(ert-deftest julia--test-end-of-defun-nested-2 ()
898-
"Point should move to end of outer function when called from inner with prefix."
899+
"Point should move to end of outer function when called from outer."
899900
(julia--should-move-point
900901
"function f(x)
901902
function fact(n)
@@ -906,7 +907,7 @@ return n * fact(n-1)
906907
end
907908
end
908909
return fact(x)
909-
end" 'end-of-defun "n == 0" "return fact(x)[ \n]+end" 'end 2))
910+
end" 'julia-end-of-defun "function f(x)" "return fact(x)[ \n]+end" 'end))
910911

911912
;;;
912913
;;; latex completion tests

0 commit comments

Comments
 (0)