-
-
Notifications
You must be signed in to change notification settings - Fork 195
/
smartparens-insertion-specification-parser-test.el
57 lines (57 loc) · 2.25 KB
/
smartparens-insertion-specification-parser-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
;; TODO: separate into separate tests for each invocation -> easier
;; debugging
(ert-deftest sp-test-insertion-specification-parser ()
(should (equal (sp--parse-insertion-spec "ab")
'(progn (insert "ab"))))
(should (equal (sp--parse-insertion-spec "a|b")
'(progn
(insert "a")
(save-excursion
(insert "b")))))
(should (equal (sp--parse-insertion-spec "a\\|b")
'(progn (insert "a|") (insert "b"))))
(should (equal (sp--parse-insertion-spec "a\\||b")
'(progn
(insert "a|")
(save-excursion
(insert "b")))))
(should (equal (sp--parse-insertion-spec "a\\[b]")
'(progn (insert "a[") (insert "b]"))))
(should (equal (sp--parse-insertion-spec "a\\[b[i]")
'(progn
(insert "a[")
(insert "b")
(indent-according-to-mode))))
(should (equal (sp--parse-insertion-spec "a||b")
'(progn
(insert "a")
(save-excursion
(insert "b"))
(indent-according-to-mode))))
(should (equal (sp--parse-insertion-spec "a|[i]b")
'(progn
(insert "a")
(save-excursion
(indent-according-to-mode)
(insert "b")))))
(should (equal (sp--parse-insertion-spec "a|b[i]")
'(progn
(insert "a")
(save-excursion
(insert "b")
(indent-according-to-mode)))))
(should (equal (sp--parse-insertion-spec "[i]a|b")
'(progn
(indent-according-to-mode)
(insert "a")
(save-excursion
(insert "b")))))
(should (equal (sp--parse-insertion-spec "[i]")
'(progn
(indent-according-to-mode))))
(should (equal (sp--parse-insertion-spec "[d3]")
'(progn
(delete-char 3))))
(should (equal (sp--parse-insertion-spec "[d12]")
'(progn
(delete-char 12)))))