-
-
Notifications
You must be signed in to change notification settings - Fork 195
/
smartparens-ocaml-test.el
40 lines (34 loc) · 1.48 KB
/
smartparens-ocaml-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
(require 'smartparens)
(require 'tuareg)
(defun sp-test--ocaml-mode ()
(shut-up (tuareg-mode)))
(ert-deftest sp-test-ocaml-forward-slurp-parenthesis-whitespace ()
"Ensure we don't add unwanted whitespace when slurping."
(sp-test-with-temp-buffer "(|foo) List.map"
(sp-test--ocaml-mode)
(sp-forward-slurp-sexp 2)
(should (equal (buffer-string) "(foo List.map)"))))
(ert-deftest sp-test-ocaml-backward-slurp-parenthesis-whitespace ()
"Ensure we don't add unwanted whitespace when slurping."
(sp-test-with-temp-buffer "List.map (|foo)"
(sp-test--ocaml-mode)
(sp-backward-slurp-sexp 2)
(should (equal (buffer-string) "(List.map foo)"))))
(ert-deftest sp-test-ocaml-forward-slurp-square-bracket-whitespace ()
"Ensure we don't add unwanted whitespace when slurping."
(sp-test-with-temp-buffer "[|foo] List.map"
(sp-test--ocaml-mode)
(sp-forward-slurp-sexp 2)
(should (equal (buffer-string) "[foo List.map]"))))
(ert-deftest sp-test-ocaml-backward-slurp-square-bracket-whitespace ()
"Ensure we don't add unwanted whitespace when slurping."
(sp-test-with-temp-buffer "List.map [|foo]"
(sp-test--ocaml-mode)
(sp-backward-slurp-sexp 2)
(should (equal (buffer-string) "[List.map foo]"))))
(ert-deftest sp-test-ocaml-splice-sexp-tilde ()
"Ensure ~ isn't removed when removing parentheses"
(sp-test-with-temp-buffer "let foo ~(|x) = x"
(sp-test--ocaml-mode)
(sp-splice-sexp)
(should (equal (buffer-string) "let foo ~x = x"))))