Test for mirroring more than one field

* yasnippet-tests.el (yas-mirror-many-fields): New test.
This commit is contained in:
Kofi Laing 2018-04-30 16:19:20 -04:00 committed by Noam Postavsky
parent 3c0be40e21
commit 760f77afb9

View File

@ -193,6 +193,20 @@ attention to case differences."
(should (string= (yas--buffer-contents)
"bla from another BLA"))))
(ert-deftest yas-mirror-many-fields ()
(with-temp-buffer
(yas-minor-mode 1)
(yas-expand-snippet "${1:brother} and ${2:brother} are${1:$(if (string= (yas-field-value 1) (yas-field-value 2)) \" \" \" not \")}the same word")
(should (string= (yas--buffer-contents)
"brother and brother are the same word"))
(yas-mock-insert "bla")
(should (string= (yas--buffer-contents)
"bla and brother are not the same word"))
(ert-simulate-command '(yas-next-field-or-maybe-expand))
(yas-mock-insert "bla")
(should (string= (yas--buffer-contents)
"bla and bla are the same word"))))
(ert-deftest mirror-with-transformation-and-autofill ()
"Test interaction of autofill with mirror transforms"
(let ((words "one two three four five")