-
-
Notifications
You must be signed in to change notification settings - Fork 287
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #163 from tkf/travis-ci
This PR adds: * Automated tests in Travis CI based on the PR #162. * AC's dependencies (popup/fuzzy) and ERT as git submodules under `lib/`. * `travis-ci` make target in Makfile, so that tests ran on Travis CI server can be ran in local machine by `make travis-ci`.
- Loading branch information
Showing
8 changed files
with
130 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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"))) | ||
))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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)) |