-
-
Notifications
You must be signed in to change notification settings - Fork 194
/
Copy pathsmartparens-search-fn-test.el
37 lines (32 loc) · 1.42 KB
/
smartparens-search-fn-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
(ert-deftest sp-test-search-backward-in-context/code/first-match-same ()
(sp-test-with-temp-elisp-buffer "f|oo bar baz"
(should (equal (sp--search-forward-in-context "bar" nil t) 8))
(sp-buffer-equals "foo bar| baz")))
(ert-deftest sp-test-search-backward-in-context/code/first-match-different ()
(sp-test-with-temp-elisp-buffer "f|oo ; bar baz"
(should (equal (sp--search-forward-in-context "bar" nil t) nil))
(sp-buffer-equals "f|oo ; bar baz")))
(ert-deftest sp-test-search-backward-in-context/code/second-match-same ()
(sp-test-with-temp-elisp-buffer "f|oo ; bar baz
bar baz"
(should (equal (sp--search-forward-in-context "bar" nil t) 18))
(sp-buffer-equals "foo ; bar baz
bar| baz")))
(ert-deftest sp-test-search-backward-in-context/comment/first-match-same ()
(sp-test-with-temp-elisp-buffer ";f|oo bar baz"
(should (equal (sp--search-forward-in-context "bar" nil t) 9))
(sp-buffer-equals ";foo bar| baz")))
(ert-deftest sp-test-search-backward-in-context/comment/first-match-different ()
(sp-test-with-temp-elisp-buffer ";f|oo
bar baz"
(should (equal (sp--search-forward-in-context "bar" nil t) nil))
(sp-buffer-equals ";f|oo
bar baz")))
(ert-deftest sp-test-search-backward-in-context/comment/second-match-same ()
(sp-test-with-temp-elisp-buffer ";f|oo
bar baz
; bar baz"
(should (equal (sp--search-forward-in-context "bar" nil t) 19))
(sp-buffer-equals ";foo
bar baz
; bar| baz")))