]> code.delx.au - gnu-emacs-elpa/commitdiff
Fix the template tests
authorDmitry Gutov <dgutov@yandex.ru>
Wed, 10 Apr 2013 01:37:35 +0000 (05:37 +0400)
committerDmitry Gutov <dgutov@yandex.ru>
Wed, 10 Apr 2013 01:38:14 +0000 (05:38 +0400)
company-tests.el

index d4ab0b733bd37cb58bb98ceae6eb3c5229ed6c02..5aa4fd8bb0ea7f76b921dda9f8b6f49a5ce66d8c 100644 (file)
 
 (ert-deftest company-template-removed-after-the-last-jump ()
   (with-temp-buffer
-    (insert "{ }")
+    (insert "{ foo foo }")
     (goto-char 2)
     (let ((tpl (company-template-declare-template (point) (1- (point-max)))))
       (save-excursion
         (dotimes (i 2)
-          (insert " ")
-          (company-template-add-field tpl (point) "foo")
-          (forward-char 3)))
+          (search-forward "foo")
+          (company-template-add-field tpl (match-beginning 0) (match-end 0))))
       (company-call 'template-forward-field)
       (should (= 3 (point)))
       (company-call 'template-forward-field)
 
 (ert-deftest company-template-removed-after-input-and-jump ()
   (with-temp-buffer
-    (insert "{ }")
+    (insert "{ bar }")
     (goto-char 2)
     (let ((tpl (company-template-declare-template (point) (1- (point-max)))))
-      (save-excursion
-        (insert " ")
-        (company-template-add-field tpl (point) "bar"))
+      (company-template-add-field tpl 3 6)
       (company-call 'template-move-to-first tpl)
       (should (= 3 (point)))
       (dolist (c (string-to-list "tee"))