Permalink
Browse files

Merge branch 'master' of github.com:auto-complete/auto-complete

  • Loading branch information...
2 parents 605094d + 8ec385e commit d790e0b8e37bd4649e06efbf848b9f8855c00fc2 Tomohiro Matsuyama committed Sep 17, 2012
Showing with 132 additions and 4 deletions.
  1. +9 −0 .gitmodules
  2. +14 −0 .travis.yml
  3. +7 −2 Makefile
  4. +2 −2 auto-complete.el
  5. +1 −0 lib/ert
  6. +1 −0 lib/fuzzy
  7. +1 −0 lib/popup
  8. +53 −0 tests/auto-complete-test.el
  9. +44 −0 tests/run-test.el
View
@@ -0,0 +1,9 @@
+[submodule "lib/fuzzy"]
+ path = lib/fuzzy
+ url = git://github.com/auto-complete/fuzzy-el.git
+[submodule "lib/popup"]
+ path = lib/popup
+ url = git://github.com/auto-complete/popup-el.git
+[submodule "lib/ert"]
+ path = lib/ert
+ url = git://github.com/ohler/ert.git
View
@@ -0,0 +1,14 @@
+language: emacs-lisp
+before_install:
+ - git submodule update --init
+ - if [ "$EMACS" = 'emacs-snapshot' ]; then
+ sudo add-apt-repository -y ppa:cassou/emacs &&
+ sudo apt-get update -qq &&
+ sudo apt-get install -qq
+ emacs-snapshot-el emacs-snapshot-gtk emacs-snapshot;
+ fi
+env:
+ - EMACS=emacs
+ - EMACS=emacs-snapshot
+script:
+ make travis-ci EMACS=$EMACS
View
@@ -1,11 +1,12 @@
VERSION=`perl -ne 'print $$1 if /;; Version: (.*)/' auto-complete.el`
PACKAGE=auto-complete-${VERSION}
+EMACS=emacs
byte-compile:
- emacs -Q -L . -batch -f batch-byte-compile auto-complete.el auto-complete-config.el
+ ${EMACS} -Q -L . -batch -f batch-byte-compile auto-complete.el auto-complete-config.el
install:
- emacs -Q -L . -batch -l etc/install ${DIR}
+ ${EMACS} -Q -L . -batch -l etc/install ${DIR}
clean:
rm -f *.elc
@@ -25,3 +26,7 @@ package.tar.bz2: tar
package.zip: package
zip -r ${PACKAGE}.zip ${PACKAGE}
+
+travis-ci:
+ ${EMACS} --version
+ ${EMACS} -batch -Q -l tests/run-test.el
View
@@ -1286,7 +1286,7 @@ that have been made before in this function."
(and menu
(popup-child-point menu parent-offset))
(point))
- nil 0
+ nil 300
popup-tip-max-width
nil nil
(and (not around) 0))
@@ -1339,7 +1339,7 @@ that have been made before in this function."
(point (marker-position (car ac-last-completion))))
(when (stringp doc)
(if (ac-quick-help-use-pos-tip-p)
- (with-no-warnings (pos-tip-show doc nil point nil 0))
+ (with-no-warnings (pos-tip-show doc nil point nil 300))
(popup-tip doc
:point point
:around t
Submodule ert added at 00aef6
Submodule fuzzy added at b47d80
Submodule popup added at f15c82
@@ -0,0 +1,53 @@
+(require 'ert)
+
+(require 'auto-complete)
+(require 'auto-complete-config)
+
+;; Move this into test case or setup macro once we start testing with
+;; non-default config.
+(ac-config-default)
+
+(defmacro ac-test-with-common-setup (&rest body)
+ (declare (indent 0) (debug t))
+ `(save-excursion
+ (with-temp-buffer
+ (switch-to-buffer (current-buffer))
+ (auto-complete-mode 1)
+ (emacs-lisp-mode)
+ ,@body
+ (ac-menu-delete)
+ )))
+
+(ert-deftest ac-test-simple-invocation ()
+ (ac-test-with-common-setup
+ (let ((ac-source-test
+ '((candidates list "Foo" "FooBar" "Bar" "Baz" "LongLongLine")))
+ (ac-source-action-test
+ '((candidates list "Action1" "Action2")
+ (action . (lambda () (message "Done!")))))
+ (ac-sources '(ac-source-test ac-source-action-test)))
+ (should-not (popup-live-p ac-menu))
+ (should (eq ac-menu nil))
+ (insert "Foo")
+ (auto-complete)
+ (should (popup-live-p ac-menu))
+ (should (equal (popup-list ac-menu) '("Foo" "FooBar")))
+ )))
+
+(ert-deftest ac-test-simple-update ()
+ (ac-test-with-common-setup
+ (let ((ac-source-test
+ '((candidates list "Foo" "FooBar" "Bar" "Baz" "LongLongLine")))
+ (ac-source-action-test
+ '((candidates list "Action1" "Action2")
+ (action . (lambda () (message "Done!")))))
+ (ac-sources '(ac-source-test ac-source-action-test)))
+ (should-not (popup-live-p ac-menu))
+ (should (eq ac-menu nil))
+ (insert "Foo")
+ (auto-complete)
+ (execute-kbd-macro "B")
+ (ac-update-greedy)
+ (should (popup-live-p ac-menu))
+ (should (equal (popup-list ac-menu) '("FooBar")))
+ )))
View
@@ -0,0 +1,44 @@
+;; Usage:
+;;
+;; emacs -Q -l tests/run-test.el # interactive mode
+;; emacs -batch -Q -l tests/run-test.el # batch mode
+
+
+;; Utils
+(defun ac-test-join-path (path &rest rest)
+ "Join a list of PATHS with appropriate separator (such as /).
+
+\(fn &rest paths)"
+ (if rest
+ (concat (file-name-as-directory path) (apply 'ac-test-join-path rest))
+ path))
+
+(defvar ac-test-dir (file-name-directory load-file-name))
+(defvar ac-root-dir (concat ac-test-dir ".."))
+
+
+;; Setup `load-path'
+(mapc (lambda (p) (add-to-list 'load-path p))
+ (list ac-test-dir
+ ac-root-dir
+ (ac-test-join-path ac-root-dir "lib" "popup")
+ (ac-test-join-path ac-root-dir "lib" "fuzzy")))
+
+
+;; Use ERT from github when this Emacs does not have it
+(unless (locate-library "ert")
+ (add-to-list
+ 'load-path
+ (ac-test-join-path ac-root-dir "lib" "ert" "lisp" "emacs-lisp"))
+ (require 'ert-batch)
+ (require 'ert-ui))
+
+
+;; Load tests
+(load "auto-complete-test")
+
+
+;; Run tests
+(if noninteractive
+ (ert-run-tests-batch-and-exit)
+ (ert t))

0 comments on commit d790e0b

Please sign in to comment.