(should (eq nil (company--good-prefix-p 'stop)))
(should (eq t (company--good-prefix-p '("foo" . 5))))
(should (eq nil (company--good-prefix-p '("foo" . 4))))))
+
+(ert-deftest company-multi-backend-with-lambdas ()
+ (let ((company-backend
+ (list (lambda (command &optional arg &rest ignore)
+ (case command
+ (prefix "z")
+ (candidates '("a" "b"))))
+ (lambda (command &optional arg &rest ignore)
+ (case command
+ (prefix "z")
+ (candidates '("c" "d")))))))
+ (should (equal (company-call-backend 'candidates "z") '("a" "b" "c" "d")))))
(apply 'company--multi-backend-adapter company-backend args)))
(defun company--multi-backend-adapter (backends command &rest args)
- (let ((backends (remove-if (lambda (b) (eq 'failed (get b 'company-init)))
+ (let ((backends (remove-if (lambda (b)
+ (and (symbolp b)
+ (eq 'failed (get b 'company-init))))
backends)))
(case command
(candidates