Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #539 from Wilfred/ignore_trailing_colons
When slurping forward, don't include punctuation at end of line.
- Loading branch information
Showing
3 changed files
with
95 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
(require 'smartparens) | ||
|
||
(ert-deftest sp-test-js-slurp-excludes-semicolon () | ||
(sp-test-with-temp-buffer "var foo = bar(|)baz;" | ||
(js-mode) | ||
(sp-slurp-hybrid-sexp) | ||
(should (equal (buffer-string) "var foo = bar(baz);")))) | ||
|
||
(ert-deftest sp-test-js-slurp-curly-paren () | ||
(sp-test-with-temp-buffer "while (true) {|} | ||
bar;" | ||
(js-mode) | ||
(sp-slurp-hybrid-sexp) | ||
(should (equal (buffer-string) "while (true) { | ||
bar; | ||
}")))) | ||
|
||
(ert-deftest sp-test-python-slurp-exclude-colon () | ||
(sp-test-with-temp-buffer "if bar(|)foo:" | ||
(python-mode) | ||
(sp-slurp-hybrid-sexp) | ||
(should (equal (buffer-string) "if bar(foo):")))) | ||
|
||
(ert-deftest sp-test-python-slurp-include-dot () | ||
(sp-test-with-temp-buffer "(|foo).bar" | ||
(python-mode) | ||
(sp-slurp-hybrid-sexp) | ||
(should (equal (buffer-string) "(foo.bar)")))) | ||
|
||
(ert-deftest sp-test-c++-slurp-include-semicolon () | ||
(sp-test-with-temp-buffer "class foo {| | ||
public: | ||
int a; | ||
}; | ||
int b = 7;" | ||
(c++-mode) | ||
(sp-slurp-hybrid-sexp) | ||
(should (equal (buffer-string) "class foo { | ||
public: | ||
int a; | ||
int b = 7; | ||
};")))) |