]> code.delx.au - gnu-emacs-elpa/blobdiff - test/core-tests.el
Move company-files closer to the front of company-backends
[gnu-emacs-elpa] / test / core-tests.el
index 13e547e3d36b15ac566ad3dcc9119ea675a7c580..46d17093b2682057a84576664cdf05e44f9c99a3 100644 (file)
       (and (ert-equal-including-properties (car list1) (car list2))
            (ct-equal-including-properties (cdr list1) (cdr list2)))))
 
+(ert-deftest company-strips-duplicates-returns-nil ()
+  (should (null (company--preprocess-candidates nil))))
+
 (ert-deftest company-strips-duplicates-within-groups ()
   (let* ((kvs '(("a" . "b")
                 ("a" . nil)
                 ("a" . "b")
                 ("a" . "c")
                 ("a" . "b")
-                ("b" . "c")
                 ("b" . nil)
-                ("a" . "b")))
+                ("b" . "c")
+                ("a" . "b")
+                ("c" . nil)
+                ("c" . nil)))
          (fn (lambda (kvs)
                (mapcar (lambda (kv) (propertize (car kv) 'ann (cdr kv)))
                        kvs)))
               (`duplicates t)
               (`annotation (get-text-property 0 'ann arg)))))
          (reference '(("a" . "b")
-                      ("a" . nil)
                       ("a" . "c")
                       ("b" . "c")
-                      ("b" . nil)
-                      ("a" . "b"))))
+                      ("a" . "b")
+                      ("c" . nil))))
     (let ((ct-sorted t))
       (should (ct-equal-including-properties
                (company--preprocess-candidates (funcall fn kvs))
                (funcall fn reference))))
     (should (ct-equal-including-properties
              (company--preprocess-candidates (funcall fn kvs))
-             (funcall fn (butlast reference))))))
+             (funcall fn (append (butlast reference 2)
+                                 (last reference)))))))
 
 ;;; Row and column