Skip to content

Commit 10657cc

Browse files
committed
Fix kbd usage in tests
1 parent b3fad60 commit 10657cc

File tree

1 file changed

+25
-38
lines changed

1 file changed

+25
-38
lines changed

test/smartparens-scala-test.el

Lines changed: 25 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -3,56 +3,43 @@
33

44
(ert-deftest sp-test-scala-bracket ()
55
"Close a normal bracket"
6-
(sp-test-with-temp-buffer
7-
"def foo|"
8-
(scala-mode)
9-
(execute-kbd-macro "(bar: String")
10-
(should (equal (buffer-string) "def foo(bar: String)"))))
6+
(sp-test-with-temp-buffer "def foo|"
7+
(scala-mode)
8+
(execute-kbd-macro "(bar: String")
9+
(should (equal (buffer-string) "def foo(bar: String)"))))
1110

1211
(ert-deftest sp-test-scala-bracket-space ()
1312
"Close a normal bracket with padding on SPACE."
14-
(sp-test-with-temp-buffer
15-
"foo.map|"
16-
(scala-mode)
17-
(execute-kbd-macro "(")
18-
(execute-kbd-macro (kbd "SPC"))
19-
(execute-kbd-macro "_.toString")
20-
(should (equal (buffer-string) "foo.map( _.toString )"))))
13+
(sp-test-with-temp-buffer "foo.map|"
14+
(scala-mode)
15+
(execute-kbd-macro "( _.toString")
16+
(should (equal (buffer-string) "foo.map( _.toString )"))))
2117

2218
(ert-deftest sp-test-scala-curly ()
2319
"Close a curly bracket"
24-
(sp-test-with-temp-buffer
25-
"foo.map|"
26-
(scala-mode)
27-
(execute-kbd-macro "{f => f.toString")
28-
(should (equal (buffer-string) "foo.map{f => f.toString}"))))
20+
(sp-test-with-temp-buffer "foo.map|"
21+
(scala-mode)
22+
(execute-kbd-macro "{f => f.toString")
23+
(should (equal (buffer-string) "foo.map{f => f.toString}"))))
2924

3025
(ert-deftest sp-test-scala-curly-space ()
3126
"Close a curly bracket with padding on SPACE"
32-
(sp-test-with-temp-buffer
33-
;; it might be nice in a future update to not need the prefix space
34-
"foo.map |"
35-
(scala-mode)
36-
(execute-kbd-macro "{")
37-
(execute-kbd-macro (kbd "SPC"))
38-
(execute-kbd-macro "f => f.toString")
39-
(should (equal (buffer-string) "foo.map { f => f.toString }"))))
27+
(sp-test-with-temp-buffer "foo.map |"
28+
;; it might be nice in a future update to not need the prefix space
29+
(scala-mode)
30+
(execute-kbd-macro "{ f => f.toString")
31+
(should (equal (buffer-string) "foo.map { f => f.toString }"))))
4032

4133
(ert-deftest sp-test-scala-curly-newline ()
4234
"Close a curly bracket with an indented block on newline"
43-
(sp-test-with-temp-buffer
44-
"foo.map |"
45-
(scala-mode)
46-
(execute-kbd-macro "{")
47-
(execute-kbd-macro (kbd "RET"))
48-
(execute-kbd-macro "f => f.toString")
49-
(should (equal (buffer-string) "foo.map {\n f => f.toString\n}"))))
35+
(sp-test-with-temp-buffer "foo.map |"
36+
(scala-mode)
37+
(execute-kbd-macro (kbd "{ RET f SPC => SPC f.toString"))
38+
(sp-buffer-equals "foo.map {\n f => f.toString|\n}")))
5039

5140
(ert-deftest sp-test-scala-curly-wrap ()
5241
"Wrap a region in an indented block"
53-
(sp-test-with-temp-buffer
54-
"|foo|"
55-
(scala-mode)
56-
(execute-kbd-macro "{")
57-
(should (equal (buffer-string) "{\n foo\n}"))))
58-
42+
(sp-test-with-temp-buffer "|fooM"
43+
(scala-mode)
44+
(execute-kbd-macro "{")
45+
(should (equal (buffer-string) "{\n foo\n}"))))

0 commit comments

Comments
 (0)