[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] 03/35: Test new prefix behavior, option company-abort-manual-when
From: |
Dmitry Gutov |
Subject: |
[elpa] 03/35: Test new prefix behavior, option company-abort-manual-when-too-short |
Date: |
Sat, 19 Apr 2014 10:12:13 +0000 |
dgutov pushed a commit to branch master
in repository elpa.
commit d38e705667bb649ebd4f6e07eb5b3383425594d0
Author: Ingo Lohmar <address@hidden>
Date: Tue Mar 25 22:42:09 2014 +0100
Test new prefix behavior, option company-abort-manual-when-too-short
---
company-tests.el | 37 ++++++++++++++++++++++++++++++++++++-
1 files changed, 36 insertions(+), 1 deletions(-)
diff --git a/company-tests.el b/company-tests.el
index 5a26086..e5fd2f7 100644
--- a/company-tests.el
+++ b/company-tests.el
@@ -46,13 +46,48 @@
(ert-deftest company-good-prefix ()
(let ((company-minimum-prefix-length 5)
- company--explicit-action)
+ company--explicit-action
+ (company-selection-changed t)) ;never enough
(should (eq t (company--good-prefix-p "address@hidden")))
(should (eq nil (company--good-prefix-p "abcd")))
(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--manual-prefix-set-and-unset ()
+ (with-temp-buffer
+ (insert "ab")
+ (company-mode)
+ (let (company-frontends
+ (company-backends
+ (list (lambda (command &optional arg)
+ (case command
+ (prefix (buffer-substring (point-min) (point)))
+ (candidates '("abc" "abd")))))))
+ (company-manual-begin)
+ (should (equal "ab" company--manual-prefix))
+ (company-abort)
+ (should (null company--manual-prefix)))))
+
+(ert-deftest company-abort-manual-when-too-short ()
+ (let ((company-minimum-prefix-length 5)
+ (company-abort-manual-when-too-short t)
+ (company-selection-changed t)) ;never enough
+ (let ((company--explicit-action nil)) ;idle begin
+ (should (eq t (company--good-prefix-p "address@hidden")))
+ (should (eq nil (company--good-prefix-p "abcd")))
+ (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)))))
+ (let ((company--explicit-action t)
+ (company--manual-prefix "abc")) ;manual begin from this prefix
+ (should (eq t (company--good-prefix-p "address@hidden")))
+ (should (eq nil (company--good-prefix-p "ab")))
+ (should (eq nil (company--good-prefix-p 'stop)))
+ (should (eq t (company--good-prefix-p '("foo" . 4))))
+ (should (eq t (company--good-prefix-p "abcd")))
+ (should (eq t (company--good-prefix-p "abcd"))))))
+
(ert-deftest company-multi-backend-with-lambdas ()
(let ((company-backend
(list (lambda (command &optional arg &rest ignore)
- [elpa] branch master updated (0c8e3a1 -> 77719a9), Dmitry Gutov, 2014/04/19
- [elpa] 02/35: More robust and simpler logic in prefix test, Dmitry Gutov, 2014/04/19
- [elpa] 03/35: Test new prefix behavior, option company-abort-manual-when-too-short,
Dmitry Gutov <=
- [elpa] 08/35: Use `condition-case-unless-debug', Dmitry Gutov, 2014/04/19
- [elpa] 04/35: Minor tweaks, Dmitry Gutov, 2014/04/19
- [elpa] 07/35: Drop support for `crop', Dmitry Gutov, 2014/04/19
- [elpa] 10/35: Bump version, Dmitry Gutov, 2014/04/19
- [elpa] 09/35: Add Package-Requires header, Dmitry Gutov, 2014/04/19
- [elpa] 13/35: Make company-clang work asynchronously, Dmitry Gutov, 2014/04/19
- [elpa] 12/35: Remove `company-locate-dominating-file', Dmitry Gutov, 2014/04/19
- [elpa] 16/35: Update NEWS, Dmitry Gutov, 2014/04/19
- [elpa] 17/35: company--merge-async: tweak, Dmitry Gutov, 2014/04/19
- [elpa] 19/35: Move company-elisp require, Dmitry Gutov, 2014/04/19