--- /dev/null
+language: emacs
+before_install:
+ - echo -e "\ndeb http://us.archive.ubuntu.com/ubuntu raring universe multiverse main" | sudo tee -a /etc/apt/sources.list
+ - echo -e "\ndeb http://emacs.naquadah.org/ stable/" | sudo tee -a /etc/apt/sources.list
+ - echo -e "\ndeb-src http://emacs.naquadah.org/ stable/" | sudo tee -a /etc/apt/sources.list
+ - cat /etc/apt/sources.list
+ - wget -q -O - http://emacs.naquadah.org/key.gpg | sudo apt-key add -
+ - sudo apt-get update
+install:
+ - sudo apt-get install emacs
+ - sudo apt-get -t raring install libgnutls26
+ - sudo apt-get install emacs-snapshot-nox
+ - curl -O https://raw.github.com/ohler/ert/c619b56c5bc6a866e33787489545b87d79973205/lisp/emacs-lisp/ert.el
+ - curl -O https://raw.github.com/ohler/ert/c619b56c5bc6a866e33787489545b87d79973205/lisp/emacs-lisp/ert-x.el
+ - curl -o cl-lib.el http://elpa.gnu.org/packages/cl-lib-0.3.el
+before_script:
+script:
+ - export EMACS=emacs; rm *.elc; rake compile; rake tests
+ - rm ert*.el; rm cl-lib.el
+ - export EMACS=emacs-snapshot; rm *.elc; rake compile; rake tests
+notifications:
+ email:
+ - joaotavora@gmail.com
--- /dev/null
+2013-12-31 João Távora <joaotavora@gmail.com>
+
+ * yasnippet.el (require): require cl-lib during byte-compilation
+ and load.
+
+ * yasnippet-tests.el (example-for-issue-404-external-emacs): Use
+ `yas-with-snippet-dirs' to not depend on bundled snippets.
+ (yas--call-with-temporary-redefinitions): Use `cl-labels' since no
+ cl-flet in emacs-24.3's cl-lib.el.
+ (loading-with-cyclic-parenthood): prog-mode doesn't exist in emacs
+ 24.3.
+ (yas-batch-run-tests): remove it.
+
+ * Rakefile: use ert-run-tests-batch-and-exit.
+
+ * README.mdown: Add Travis CI badge.
+
+ * .travis.yml: new file
desc "run tests in batch mode"
task :tests do
- batch_run_line = "(yas-batch-run-tests t)"
- sh "#{$EMACS} -Q -L . -l yasnippet-tests.el -nw" +
- " --batch --eval '#{batch_run_line}'"
+ sh "#{$EMACS} -Q -L . -l yasnippet-tests.el" +
+ " --batch -f ert-run-tests-batch-and-exit"
end
desc "create a release package"
(insert (pp-to-string
`(condition-case _
(progn
- (require 'yasnippet)
- (yas-global-mode)
- (switch-to-buffer "foo.c")
- (c-mode)
- (insert "#include <iostream>\nmain")
- (setq yas-good-grace nil)
- (yas-expand)
- (kill-emacs 0))
+ (require 'yasnippet-tests)
+ (yas-with-snippet-dirs
+ '((".emacs.d/snippets"
+ ("c-mode"
+ ("main" . "int main ()"))))
+ (yas-global-mode)
+ (switch-to-buffer "foo.c")
+ (c-mode)
+ (insert "#include <iostream>\nmain")
+ (setq yas-good-grace nil)
+ (yas-expand)
+ (should (string= (buffer-string)
+ "#include <iostream>\nint main ()"))
+ (kill-emacs 0)))
(error (kill-emacs -1)))))
(write-file fixture-el-file))
(should (= 0
(call-process (concat invocation-directory invocation-name)
nil nil nil
- "-Q" ;; "--batch"
+ "-Q" "--batch"
"-L" "." "-l" fixture-el-file)))))
(ert-deftest middle-of-buffer-snippet-insertion ()
;; saving all definitions before overriding anything ensures FDEFINITION
;; errors don't cause accidental permanent redefinitions.
;;
- (cl-flet ((set-fdefinitions (names functions)
- (loop for name in names
- for fn in functions
- do (fset name fn))))
+ (cl-labels ((set-fdefinitions (names functions)
+ (loop for name in names
+ for fn in functions
+ do (fset name fn))))
(set-fdefinitions definition-names overriding-functions)
(unwind-protect (funcall function)
(set-fdefinitions definition-names saved-functions)))))
(yas-reload-all)
(with-temp-buffer
(let* ((major-mode 'c-mode)
- (expected '(c-mode
+ (expected `(c-mode
cc-mode
yet-another-c-mode
and-also-this-one
and-that-one
- prog-mode
+ ;; prog-mode doesn't exit in emacs 24.3
+ ,@(if (fboundp 'prog-mode)
+ '(prog-mode))
emacs-lisp-mode
lisp-interaction-mode))
(observed (yas--modes-to-activate)))
\f
;;; Helpers
;;;
-(defun yas-batch-run-tests (&optional also-external)
- (interactive)
- (with-temp-buffer
- (yas--with-temporary-redefinitions
- ((message (&rest _args) nil))
- (ert (or (and also-external t)
- '(not (tag :external))) (buffer-name (current-buffer)))
- (princ (buffer-string)))))
-
(defun yas-should-expand (keys-and-expansions)
(dolist (key-and-expansion keys-and-expansions)
(yas-exit-all-snippets)