add: another little test

This commit is contained in:
Joao Tavora 2013-10-17 18:50:59 +01:00
parent 55eaf62fd3
commit 9927e08d89

View File

@ -34,13 +34,11 @@
(mirror 1 (if (string-match "%" field-text) "\)" "")))) (mirror 1 (if (string-match "%" field-text) "\)" ""))))
(ert-deftest printf-expansion () (ert-deftest printf-expansion ()
""
(with-temp-buffer (with-temp-buffer
(funcall (eval `(make-snippet ,@snippet--printf-snippet-forms))) (funcall (eval `(make-snippet ,@snippet--printf-snippet-forms)))
(should (equal (buffer-string) "printf (\"%s\",)")))) (should (equal (buffer-string) "printf (\"%s\",)"))))
(ert-deftest printf-mirrors () (ert-deftest printf-mirrors ()
""
(with-temp-buffer (with-temp-buffer
(funcall (eval `(make-snippet ,@snippet--printf-snippet-forms))) (funcall (eval `(make-snippet ,@snippet--printf-snippet-forms)))
(ert-simulate-command '(delete-forward-char 1)) (ert-simulate-command '(delete-forward-char 1))
@ -49,7 +47,6 @@
(should (equal (buffer-string) "printf (\"%s\",)")))) (should (equal (buffer-string) "printf (\"%s\",)"))))
(ert-deftest printf-mirrors-and-navigation () (ert-deftest printf-mirrors-and-navigation ()
""
(with-temp-buffer (with-temp-buffer
(funcall (eval `(make-snippet ,@snippet--printf-snippet-forms))) (funcall (eval `(make-snippet ,@snippet--printf-snippet-forms)))
(ert-simulate-command '(delete-forward-char 1)) (ert-simulate-command '(delete-forward-char 1))
@ -59,3 +56,10 @@
(ert-simulate-command '(snippet-next-field)) (ert-simulate-command '(snippet-next-field))
(ert-simulate-command '((lambda () (interactive) (insert "somevar")))) (ert-simulate-command '((lambda () (interactive) (insert "somevar"))))
(should (equal (buffer-string) "printf (\"%s\",somevar)")))) (should (equal (buffer-string) "printf (\"%s\",somevar)"))))
(ert-deftest printf-jump-to-second-field-right-away ()
(with-temp-buffer
(funcall (eval `(make-snippet ,@snippet--printf-snippet-forms)))
(ert-simulate-command '(snippet-next-field))
(ert-simulate-command '((lambda () (interactive) (insert "somevar"))))
(should (equal (buffer-string) "printf (\"%s\",somevar)"))))