emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] master f3d0e03 25/63: * yasnippet-tests.el (snippet-exit-hooks):


From: Noam Postavsky
Subject: [elpa] master f3d0e03 25/63: * yasnippet-tests.el (snippet-exit-hooks): New test.
Date: Mon, 17 Jul 2017 22:54:14 -0400 (EDT)

branch: master
commit f3d0e03a05d3422bbeec1ed57514cc1628181251
Author: Noam Postavsky <address@hidden>
Commit: Noam Postavsky <address@hidden>

    * yasnippet-tests.el (snippet-exit-hooks): New test.
---
 yasnippet-tests.el | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)

diff --git a/yasnippet-tests.el b/yasnippet-tests.el
index a6abcb7..dc0c43c 100644
--- a/yasnippet-tests.el
+++ b/yasnippet-tests.el
@@ -553,6 +553,36 @@ TODO: correct this bug!"
                      "brother from another mother") ;; no newline should be 
here!
             )))
 
+(ert-deftest snippet-exit-hooks ()
+  (defvar yas--ran-exit-hook)
+  (with-temp-buffer
+    (yas-saving-variables
+     (let ((yas--ran-exit-hook nil)
+           (yas-triggers-in-field t))
+       (yas-with-snippet-dirs
+         '((".emacs.d/snippets"
+            ("emacs-lisp-mode"
+             ("foo" . "\
+# expand-env: ((yas-after-exit-snippet-hook (lambda () (setq 
yas--ran-exit-hook t))))
+# --
+FOO ${1:f1} ${2:f2}")
+             ("sub" . "\
+# expand-env: ((yas-after-exit-snippet-hook (lambda () (setq 
yas--ran-exit-hook 'sub))))
+# --
+SUB"))))
+         (yas-reload-all)
+         (emacs-lisp-mode)
+         (yas-minor-mode +1)
+         (insert "foo")
+         (ert-simulate-command '(yas-expand))
+         (should-not yas--ran-exit-hook)
+         (yas-mock-insert "sub")
+         (ert-simulate-command '(yas-expand))
+         (ert-simulate-command '(yas-next-field))
+         (should-not yas--ran-exit-hook)
+         (ert-simulate-command '(yas-next-field))
+         (should (eq yas--ran-exit-hook t)))))))
+
 (defvar yas--barbaz)
 (defvar yas--foobarbaz)
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]