summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFilipe Silva <ninrod@users.noreply.github.com>2017-09-10 23:52:20 -0300
committerGitHub <noreply@github.com>2017-09-10 23:52:20 -0300
commit7839abe0e04740e2928a6b799557d1b16460fa5f (patch)
treec6d68dbc33278dafbddbc728cf534d88fc761eea
parent4e739e8ec8dea55465c47d71c6504a0fd3e21013 (diff)
parent5ea0a9ae5aa078b54f8a3f9e703639ee2f7b50e4 (diff)
Merge pull request #120 from edkolev/use-examples-as-tests
Add examples from readme as automated tests
-rw-r--r--evil-surround.el2
-rw-r--r--test/evil-surround-test.el26
2 files changed, 25 insertions, 3 deletions
diff --git a/evil-surround.el b/evil-surround.el
index 7bdb986..bfe6056 100644
--- a/evil-surround.el
+++ b/evil-surround.el
@@ -258,7 +258,6 @@ If OPERATION is `change', call `evil-surround-change'.
if OPERATION is `delete', call `evil-surround-delete'.
Otherwise call `evil-surround-region'."
(interactive (evil-surround-interactive-setup))
- (message "%s" operation)
(cond
((eq operation 'change)
(call-interactively 'evil-surround-change))
@@ -273,7 +272,6 @@ Otherwise call `evil-surround-region'."
It does nothing for change / delete."
(interactive (evil-surround-interactive-setup))
- (message "%s" operation)
(cond
((eq operation 'change) nil)
((eq operation 'delete) nil)
diff --git a/test/evil-surround-test.el b/test/evil-surround-test.el
index bbfe45a..240ec7a 100644
--- a/test/evil-surround-test.el
+++ b/test/evil-surround-test.el
@@ -14,4 +14,28 @@
("csb'")
"one 'two' three"
("ds'")
- "one two three")))
+ "one two three"))
+ (ert-info ("examples from readme")
+ (evil-test-buffer
+ :visual-start nil
+ :visual-end nil
+ "\"Hello world!\""
+ (turn-on-evil-surround-mode)
+ ("cs\"'")
+ "'Hello world!'"
+ ("cs'<q>")
+ "<q>Hello world!</q>"
+ ("cst\"")
+ "\"Hello world!\""
+ ("ds\"")
+ "Hello world!"
+ ("ysiw]")
+ "[Hello] world!"
+ ("cs[{")
+ "{ Hello } world!"
+ ("yssb")
+ "({ Hello } world!)"
+ ("lds{ds)") ;; 'l' to move the cursor right, inside brackets
+ "Hello world!"
+ ("ysiw<em>")
+ "<em>Hello</em> world!")))