|
3 | 3 |
|
4 | 4 | (ert-deftest sp-test-scala-bracket ()
|
5 | 5 | "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)")))) |
11 | 10 |
|
12 | 11 | (ert-deftest sp-test-scala-bracket-space ()
|
13 | 12 | "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 )")))) |
21 | 17 |
|
22 | 18 | (ert-deftest sp-test-scala-curly ()
|
23 | 19 | "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}")))) |
29 | 24 |
|
30 | 25 | (ert-deftest sp-test-scala-curly-space ()
|
31 | 26 | "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 }")))) |
40 | 32 |
|
41 | 33 | (ert-deftest sp-test-scala-curly-newline ()
|
42 | 34 | "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}"))) |
50 | 39 |
|
51 | 40 | (ert-deftest sp-test-scala-curly-wrap ()
|
52 | 41 | "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