mirror of
https://github.com/joaotavora/yasnippet.git
synced 2025-10-14 05:23:04 +00:00
add: tests for clearing unmodified fields
This commit is contained in:
parent
fe4b622a5e
commit
5a067b8d3a
@ -54,8 +54,7 @@
|
||||
(defun snippet--insert-test-snippet (name)
|
||||
(funcall (make-snippet (cadr (assoc name snippet--test-snippets-alist)))))
|
||||
|
||||
|
||||
(ert-deftest foo-expansion ()
|
||||
(ert-deftest basic-expansion ()
|
||||
(with-temp-buffer
|
||||
(snippet--insert-test-snippet 'basic)
|
||||
(should (equal (buffer-string) "foo bar foo"))
|
||||
@ -63,6 +62,19 @@
|
||||
(overlay-end snippet--field-overlay))
|
||||
"foo" ))))
|
||||
|
||||
(ert-deftest basic-clear-field ()
|
||||
(with-temp-buffer
|
||||
(snippet--insert-test-snippet 'basic)
|
||||
(ert-simulate-command '((lambda () (interactive) (insert "baz"))))
|
||||
(should (equal (buffer-string) "baz bar baz"))))
|
||||
|
||||
(ert-deftest basic-delete-char-in-field ()
|
||||
(with-temp-buffer
|
||||
(snippet--insert-test-snippet 'basic)
|
||||
(ert-simulate-command '(delete-forward-char 1))
|
||||
(ert-simulate-command '((lambda () (interactive) (insert "b"))))
|
||||
(should (equal (buffer-string) "boo bar boo"))))
|
||||
|
||||
(ert-deftest contrived ()
|
||||
(with-temp-buffer
|
||||
(snippet--insert-test-snippet 'contrived)
|
||||
@ -87,6 +99,7 @@
|
||||
(ert-simulate-command '((lambda () (interactive) (insert "foo"))))
|
||||
(should (equal (buffer-string) "foobarbaz"))))
|
||||
|
||||
|
||||
(ert-deftest printf-expansion ()
|
||||
(with-temp-buffer
|
||||
(snippet--insert-test-snippet 'printf)
|
||||
|
Loading…
x
Reference in New Issue
Block a user