branch: master
commit 760f77afb9d98f39130f058b4002ed00cd009bad
Author: Kofi Laing <[email protected]>
Commit: Noam Postavsky <[email protected]>
Test for mirroring more than one field
* yasnippet-tests.el (yas-mirror-many-fields): New test.
---
yasnippet-tests.el | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/yasnippet-tests.el b/yasnippet-tests.el
index 95606f2..cccd54c 100644
--- a/yasnippet-tests.el
+++ b/yasnippet-tests.el
@@ -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")