]> code.delx.au - gnu-emacs-elpa/blobdiff - test/core-tests.el
Revert "Remove completions without annotations when considering duplicates"
[gnu-emacs-elpa] / test / core-tests.el
index dcadfd3ab70f6f74d5da8fe592948748a251ebe4..666ed80e000805ced9922c2e10e88df00e337ea0 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" . nil)
                 ("b" . "c")
-                ("a" . "b")
-                ("c" . nil)
-                ("c" . nil)))
+                ("b" . nil)
+                ("a" . "b")))
          (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")
-                      ("a" . "b")
-                      ("c" . nil))))
+                      ("b" . nil)
+                      ("a" . "b"))))
     (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 (append (butlast reference 2)
-                                 (last reference)))))))
+             (funcall fn (butlast reference))))))
 
 ;;; Row and column