[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 71f0142 50/60: Improve test simulatulation of self-insert
From: |
João Távora |
Subject: |
[elpa] master 71f0142 50/60: Improve test simulatulation of self-insert |
Date: |
Thu, 21 Jan 2016 22:36:06 +0000 |
branch: master
commit 71f0142edae6196535bfc27b79f317dc7a12ea1d
Author: Noam Postavsky <address@hidden>
Commit: Noam Postavsky <address@hidden>
Improve test simulatulation of self-insert
* yasnippet-tests.el (yas-mock-insert): Use `ert-simulate-command' to
simulate n self-insert-commands.
(simple-mirror, mirror-with-transformation):
(primary-field-transformation, nested-placeholders-kill-superfield):
(nested-placeholders-use-subfield):
(mirrors-adjacent-to-fields-with-nested-mirrors):
(deep-nested-mirroring-issue-351, example-for-issue-271):
(string-match-with-subregexp-in-mirror-transformations): Call
`yas-mock-insert' directly instead of with `ert-simulate-command'.
---
yasnippet-tests.el | 29 ++++++++++++++---------------
1 files changed, 14 insertions(+), 15 deletions(-)
diff --git a/yasnippet-tests.el b/yasnippet-tests.el
index 9a1e2c2..29a61dc 100644
--- a/yasnippet-tests.el
+++ b/yasnippet-tests.el
@@ -53,7 +53,7 @@
(yas-expand-snippet "${1:brother} from another $1")
(should (string= (yas--buffer-contents)
"brother from another brother"))
- (ert-simulate-command `(yas-mock-insert "bla"))
+ (yas-mock-insert "bla")
(should (string= (yas--buffer-contents)
"bla from another bla"))))
@@ -63,7 +63,7 @@
(yas-expand-snippet "${1:brother} from another ${1:$(upcase yas-text)}")
(should (string= (yas--buffer-contents)
"brother from another BROTHER"))
- (ert-simulate-command `(yas-mock-insert "bla"))
+ (yas-mock-insert "bla")
(should (string= (yas--buffer-contents)
"bla from another BLA"))))
@@ -73,7 +73,7 @@
(let ((snippet "${1:$$(upcase yas-text)}${1:$(concat \"bar\" yas-text)}"))
(yas-expand-snippet snippet)
(should (string= (yas--buffer-contents) "bar"))
- (ert-simulate-command `(yas-mock-insert "foo"))
+ (yas-mock-insert "foo")
(should (string= (yas--buffer-contents) "FOObarFOO")))))
(ert-deftest nested-placeholders-kill-superfield ()
@@ -82,7 +82,7 @@
(yas-expand-snippet "brother from ${2:another ${3:mother}}!")
(should (string= (yas--buffer-contents)
"brother from another mother!"))
- (ert-simulate-command `(yas-mock-insert "bla"))
+ (yas-mock-insert "bla")
(should (string= (yas--buffer-contents)
"brother from bla!"))))
@@ -91,7 +91,7 @@
(yas-minor-mode 1)
(yas-expand-snippet "brother from ${2:another ${3:mother}}!")
(ert-simulate-command '(yas-next-field-or-maybe-expand))
- (ert-simulate-command `(yas-mock-insert "bla"))
+ (yas-mock-insert "bla")
(should (string= (yas--buffer-contents)
"brother from another bla!"))))
@@ -101,7 +101,7 @@
(yas-expand-snippet "<%= f.submit \"${1:Submit}\"${2:$(and (yas-text) \",
:disable_with => '\")}${2:$1ing...}${2:$(and (yas-text) \"'\")} %>")
(should (string= (yas--buffer-contents)
"<%= f.submit \"Submit\", :disable_with => 'Submiting...'
%>"))
- (ert-simulate-command `(yas-mock-insert "Send"))
+ (yas-mock-insert "Send")
(should (string= (yas--buffer-contents)
"<%= f.submit \"Send\", :disable_with => 'Sending...'
%>"))))
@@ -109,7 +109,7 @@
(with-temp-buffer
(yas-minor-mode 1)
(yas-expand-snippet "${1:FOOOOOOO}${2:$1}${3:$2}${4:$3}")
- (ert-simulate-command `(yas-mock-insert "abc"))
+ (yas-mock-insert "abc")
(should (string= (yas--buffer-contents) "abcabcabcabc"))))
(ert-deftest delete-numberless-inner-snippet-issue-562 ()
@@ -137,7 +137,7 @@
;; (yas-minor-mode 1)
;; (yas-expand-snippet "brother from ${2:another ${3:mother}}!")
;; (ert-simulate-command '(yas-next-field-or-maybe-expand))
-;; (ert-simulate-command `(yas-mock-insert "bla"))
+;; (yas-mock-insert "bla")
;; (ert-simulate-command '(undo))
;; (should (string= (yas--buffer-contents)
;; "brother from another mother!"))))
@@ -222,7 +222,7 @@
(snippet "if ${1:condition}\n`yas-selected-text`\nelse\n$3\nend"))
(yas-expand-snippet snippet)
(yas-next-field)
- (ert-simulate-command `(yas-mock-insert "bbb"))
+ (yas-mock-insert "bbb")
(should (string= (yas--buffer-contents) "if
condition\naaa\nelse\nbbb\nend")))))
(defmacro yas--with-font-locked-temp-buffer (&rest body)
@@ -314,9 +314,9 @@
\"fail\")}"))
(yas-expand-snippet snippet)
(should (string= (yas--buffer-contents) "fail"))
- (ert-simulate-command `(yas-mock-insert "foobaaar"))
+ (yas-mock-insert "foobaaar")
(should (string= (yas--buffer-contents) "foobaaarfail"))
- (ert-simulate-command `(yas-mock-insert "baz"))
+ (yas-mock-insert "baz")
(should (string= (yas--buffer-contents) "foobaaarbazok")))))
@@ -810,10 +810,9 @@ add the snippets associated with the given mode."
(yas--buffer-contents))))))
(defun yas-mock-insert (string)
- (interactive)
- (do ((i 0 (1+ i)))
- ((= i (length string)))
- (insert (aref string i))))
+ (dotimes (i (length string))
+ (let ((last-command-event (aref string i)))
+ (ert-simulate-command '(self-insert-command 1)))))
(defun yas-make-file-or-dirs (ass)
(let ((file-or-dir-name (car ass))
- [elpa] master d78181a 46/60: Remove yas--inhibit-overlay-hooks macro., (continued)
- [elpa] master d78181a 46/60: Remove yas--inhibit-overlay-hooks macro., João Távora, 2016/01/21
- [elpa] master 17fe790 51/60: Fix #515; only clear field on self-insert, João Távora, 2016/01/21
- [elpa] master 67a45a6 48/60: * README.mdown: Add link to textmate-to-yas.el., João Távora, 2016/01/21
- [elpa] master c80fbf2 49/60: Cleanup yas--on-field-overlay-modification, João Távora, 2016/01/21
- [elpa] master 444c882 47/60: * README.mdown: update melpa URL., João Távora, 2016/01/21
- [elpa] master 61261c9 53/60: Fix #576; don't override yas-prompt-functions, João Távora, 2016/01/21
- [elpa] master a2c5292 55/60: Bless Noam Postavsky as the new official maintainer, João Távora, 2016/01/21
- [elpa] master cd05da6 36/60: Activate extra and major modes first, João Távora, 2016/01/21
- [elpa] master 3cd64b7 45/60: yasnippet.el (yas--called-interactively-p): Remove., João Távora, 2016/01/21
- [elpa] master 140c415 52/60: Respect y-b-l-cond from binding triggered snippets, João Távora, 2016/01/21
- [elpa] master 71f0142 50/60: Improve test simulatulation of self-insert,
João Távora <=
- [elpa] master e6fff09 54/60: Don't choose ido prompting based on Emacs version, João Távora, 2016/01/21
- [elpa] master af90528 56/60: Fix debugging code for newer Emacsen, João Távora, 2016/01/21
- [elpa] master 100d8d1 57/60: Fix bug reporting examples., João Távora, 2016/01/21
- [elpa] master 46256db 58/60: Fix #648; create ~/.emacs.d/snippets automatically, João Távora, 2016/01/21
- [elpa] master 1a98c38 59/60: Fix silly mistake in previous commit, João Távora, 2016/01/21
- [elpa] master 5817fe1 60/60: Update packages/yasnippet by subtree-merging from its external upstream, João Távora, 2016/01/21