-
-
Notifications
You must be signed in to change notification settings - Fork 195
/
smartparens-markdown-test.el
100 lines (85 loc) · 3.22 KB
/
smartparens-markdown-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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
(require 'markdown-mode)
(require 'smartparens-markdown)
(ert-deftest sp-test-markdown-gfm-electric-backquote-disabled ()
"Test that tripple-backquotes are properly paired in `gfm-mode'
with `markdown-gfm-use-electric-backquote' disabled."
(let ((markdown-gfm-use-electric-backquote nil))
(sp-test-with-temp-buffer "|"
(gfm-mode)
(execute-kbd-macro "```")
(sp-buffer-equals "```|```"))))
(ert-deftest sp-test-markdown-gfm-electric-backquote-enabled ()
"Test that tripple-backquotes are properly paired in `gfm-mode'
with `markdown-gfm-use-electric-backquote' enabled."
(let ((markdown-gfm-use-electric-backquote t))
(sp-test-with-temp-buffer "|"
(gfm-mode)
(execute-kbd-macro "```php")
(sp-buffer-equals "``` php
|
```"))))
(ert-deftest sp-test-markdown-tripple-backquote ()
"Test that tripple-backquotes are properly paired in `markdown-mode'."
(sp-test-with-temp-buffer "|"
(markdown-mode)
(execute-kbd-macro "```")
(sp-buffer-equals "```|```")))
(ert-deftest sp-test-markdown-insert-new-list-item ()
(sp-test-with-temp-buffer "|"
(markdown-mode)
(execute-kbd-macro "* foo bar")
(sp-buffer-equals "* foo bar|")))
(ert-deftest sp-test-markdown-insert-star-pair ()
(sp-test-with-temp-buffer "|"
(markdown-mode)
(execute-kbd-macro "foo *bar")
(sp-buffer-equals "foo *bar|*")))
(ert-deftest sp-test-markdown-do-not-insert-star-pair-if-followed-by-spc ()
(sp-test-with-temp-buffer "|"
(markdown-mode)
(execute-kbd-macro "foo * bar")
(sp-buffer-equals "foo * bar|")))
(ert-deftest sp-test-markdown-do-not-insert-star-pair-if-preceded-by-word ()
(sp-test-with-temp-buffer "|"
(markdown-mode)
(execute-kbd-macro "foo* bar")
(sp-buffer-equals "foo* bar|")))
(ert-deftest sp-test-markdown-insert-double-star-pair ()
(sp-test-with-temp-buffer "|"
(markdown-mode)
(execute-kbd-macro "foo **bar")
(sp-buffer-equals "foo **bar|**")))
(ert-deftest sp-test-markdown-unwrap-single-star ()
(sp-test-with-temp-buffer "foo *ba|r* baz"
(markdown-mode)
(sp-unwrap-sexp)
(sp-buffer-equals "foo ba|r baz")))
(ert-deftest sp-test-markdown-unwrap-double-star ()
(sp-test-with-temp-buffer "foo **ba|r** baz"
(markdown-mode)
(sp-unwrap-sexp)
(sp-buffer-equals "foo ba|r baz")))
(ert-deftest sp-test-markdown-ignore-list-bullet-when-parsing ()
(sp-test-with-temp-buffer "* foo bar| * ads"
(markdown-mode)
(should-not (sp-get-enclosing-sexp))))
(ert-deftest sp-test-markdown-insert-underscore-pair ()
(sp-test-with-temp-buffer "|"
(markdown-mode)
(execute-kbd-macro "foo _bar")
(sp-buffer-equals "foo _bar|_")))
(ert-deftest sp-test-markdown-wrap-with-star-pair ()
(sp-test-with-temp-buffer "foo |barM baz"
(markdown-mode)
(execute-kbd-macro "*")
(sp-buffer-equals "foo *|barM* baz")))
(ert-deftest sp-test-markdown-wrap-with-doublestar-pair ()
(sp-test-with-temp-buffer "foo |barM baz"
(markdown-mode)
(execute-kbd-macro "**")
(sp-buffer-equals "foo **|barM** baz")))
(ert-deftest sp-test-markdown-wrap-with-underscore-pair ()
(sp-test-with-temp-buffer "foo |barM baz"
(markdown-mode)
(execute-kbd-macro "_")
(sp-buffer-equals "foo _|barM_ baz")))