mirror of
https://github.com/joaotavora/yasnippet.git
synced 2025-10-13 21:13:04 +00:00
* yasnippet-tests.el (snippet-exit-hooks): New test.
This commit is contained in:
parent
6c4fbb25b3
commit
f3d0e03a05
@ -553,6 +553,36 @@ TODO: correct this bug!"
|
|||||||
"brother from another mother") ;; no newline should be here!
|
"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--barbaz)
|
||||||
(defvar yas--foobarbaz)
|
(defvar yas--foobarbaz)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user