-
-
Notifications
You must be signed in to change notification settings - Fork 195
/
smartparens-movement-test.el
62 lines (50 loc) · 2.39 KB
/
smartparens-movement-test.el
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
(require 'smartparens)
(ert-deftest sp-test-next-sexp ()
(sp-test-with-temp-elisp-buffer "|(foo) (bar)"
(call-interactively 'sp-next-sexp)
(sp-buffer-equals "(foo) |(bar)"))
(sp-test-with-temp-elisp-buffer "(f|oo bar)"
(call-interactively 'sp-next-sexp)
(sp-buffer-equals "(|foo bar)"))
(sp-test-with-temp-elisp-buffer "(f|oo bar)"
(set (make-local-variable 'sp-navigate-interactive-always-progress-point) t)
(call-interactively 'sp-next-sexp)
(sp-buffer-equals "(foo |bar)"))
(sp-test-with-temp-elisp-buffer "(foo) |(bar)"
(set (make-local-variable 'sp-navigate-interactive-always-progress-point) t)
(call-interactively 'sp-next-sexp)
(sp-buffer-equals "(foo) |(bar)"))
(sp-test-with-temp-elisp-buffer "((fo|o) (bar))"
(set (make-local-variable 'sp-navigate-interactive-always-progress-point) t)
(call-interactively 'sp-next-sexp)
(sp-buffer-equals "((foo) |(bar))"))
(sp-test-with-temp-elisp-buffer "(((f|oo))) bar"
(set (make-local-variable 'sp-navigate-interactive-always-progress-point) t)
(call-interactively 'sp-next-sexp)
(sp-buffer-equals "(((foo))) |bar")))
(ert-deftest sp-test-next-sexp-jump-up ()
"`sp-next-sexp' should jump up a level when
there are no more expressions at the current level."
(sp-test-with-temp-elisp-buffer "(foo|) (bar)"
(call-interactively 'sp-next-sexp)
(sp-buffer-equals "|(foo) (bar)")))
(ert-deftest sp-test-previous-sexp ()
"Basic test of `sp-previous-sexp'."
(sp-test-with-temp-elisp-buffer "((foo) bar| (baz quux))"
(call-interactively 'sp-previous-sexp)
(sp-buffer-equals "((foo)| bar (baz quux))"))
(sp-test-with-temp-elisp-buffer "((foo)| bar (baz quux))"
(call-interactively 'sp-previous-sexp)
(sp-buffer-equals "((foo) bar (baz quux))|"))
(sp-test-with-temp-elisp-buffer "(foo b|ar baz)"
(set (make-local-variable 'sp-navigate-interactive-always-progress-point) t)
(call-interactively 'sp-previous-sexp)
(sp-buffer-equals "(foo| bar baz)"))
(sp-test-with-temp-elisp-buffer "(f|oo bar baz)"
(set (make-local-variable 'sp-navigate-interactive-always-progress-point) t)
(call-interactively 'sp-previous-sexp)
(sp-buffer-equals "(foo bar baz)|"))
(sp-test-with-temp-elisp-buffer "(foo (b|ar baz))"
(set (make-local-variable 'sp-navigate-interactive-always-progress-point) t)
(call-interactively 'sp-previous-sexp)
(sp-buffer-equals "(foo| (bar baz))")))