]> code.delx.au - gnu-emacs-elpa/commitdiff
Fix a broken test, remove a duplicate one
authorDmitry Gutov <dgutov@yandex.ru>
Tue, 14 Jan 2014 13:20:59 +0000 (15:20 +0200)
committerDmitry Gutov <dgutov@yandex.ru>
Tue, 14 Jan 2014 13:20:59 +0000 (15:20 +0200)
company-tests.el
company.el

index b111822bbe7316f84448b5abe061da1b4e174029..e9116b21be9602776a94eb3768ff691383a22f80 100644 (file)
   (with-temp-buffer
     (company-mode)
     (let (company-frontends
+          company-end-of-buffer-workaround
           (company-backends
            (list (lambda (command &optional arg)
                    (case command
         (company-complete))
       (should (string= "ab" (buffer-string)))
       (delete-char -2)
-      (insert "AB") ; hack, to keep it in one test
+      (insert "A") ; hack, to keep it in one test
       (company-complete-selection)
       (should (string= "abcd" (buffer-string))))))
 
       (company-complete-selection)
       (should (string= "ABcd" (buffer-string))))))
 
-(ert-deftest company-non-prefix-completion ()
-  (with-temp-buffer
-    (insert "tc")
-    (company-mode)
-    (let (company-frontends
-          company-end-of-buffer-workaround
-          (company-backends
-           (list (lambda (command &optional arg)
-                   (case command
-                     (prefix (buffer-substring (point-min) (point)))
-                     (candidates '("tea-cup" "teal-color")))))))
-      (let (this-command)
-        (company-complete))
-      (should (string= "tc" (buffer-string))))))
-
 (ert-deftest company-non-prefix-completion ()
   (with-temp-buffer
     (insert "tc")
index 1015415c6e6b5c13f4adb610f211ad6a3703a43a..1a324c723687cc589e14b55bad9ec9a79796eeea 100644 (file)
@@ -828,13 +828,13 @@ can retrieve meta-data for them."
   ;; Save in cache:
   (push (cons company-prefix company-candidates) company-candidates-cache)
   ;; Calculate common.
-  (let ((completion-ignore-case (company-call-backend 'ignore-case))
-        ;; We want to support non-prefix completion, so filtering is the
-        ;; responsibility of each respective backend, not ours.
-        ;; On the other hand, we don't want to replace non-prefix input in
-        ;; `company-complete-common'.
-        (common (try-completion company-prefix company-candidates)))
-    (setq company-common (company--safe-candidate common))))
+  (let ((completion-ignore-case (company-call-backend 'ignore-case)))
+    ;; We want to support non-prefix completion, so filtering is the
+    ;; responsibility of each respective backend, not ours.
+    ;; On the other hand, we don't want to replace non-prefix input in
+    ;; `company-complete-common'.
+    (setq company-common (company--safe-candidate
+                          (try-completion company-prefix company-candidates)))))
 
 (defun company--safe-candidate (str)
   (or (company-call-backend 'crop str)