Add Travis CI and update tests. Start a Changelog.

* .travis.yml: new file

* README.mdown: Add Travis CI badge.

* Rakefile: use ert-run-tests-batch-and-exit.

* 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.

* yasnippet.el (require): require cl-lib during byte-compilation
and load.
This commit is contained in:
Joao Tavora 2013-12-31 15:33:20 +00:00
parent f94c38eade
commit 12b7f82dd8
6 changed files with 70 additions and 27 deletions

23
.travis.yml Normal file
View File

@ -0,0 +1,23 @@
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

18
ChangeLog Normal file
View File

@ -0,0 +1,18 @@
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

View File

@ -1,3 +1,5 @@
[![Build Status](https://travis-ci.org/capitaomorte/yasnippet.png)](https://travis-ci.org/capitaomorte/yasnippet)
# Intro # Intro
**YASnippet** is a template system for Emacs. It allows you to **YASnippet** is a template system for Emacs. It allows you to

View File

@ -16,9 +16,8 @@ FileUtils.mkdir_p('pkg')
desc "run tests in batch mode" desc "run tests in batch mode"
task :tests do task :tests do
batch_run_line = "(yas-batch-run-tests t)" sh "#{$EMACS} -Q -L . -l yasnippet-tests.el" +
sh "#{$EMACS} -Q -L . -l yasnippet-tests.el -nw" + " --batch -f ert-run-tests-batch-and-exit"
" --batch --eval '#{batch_run_line}'"
end end
desc "create a release package" desc "create a release package"

View File

@ -229,20 +229,26 @@
(insert (pp-to-string (insert (pp-to-string
`(condition-case _ `(condition-case _
(progn (progn
(require 'yasnippet) (require 'yasnippet-tests)
(yas-global-mode) (yas-with-snippet-dirs
(switch-to-buffer "foo.c") '((".emacs.d/snippets"
(c-mode) ("c-mode"
(insert "#include <iostream>\nmain") ("main" . "int main ()"))))
(setq yas-good-grace nil) (yas-global-mode)
(yas-expand) (switch-to-buffer "foo.c")
(kill-emacs 0)) (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))))) (error (kill-emacs -1)))))
(write-file fixture-el-file)) (write-file fixture-el-file))
(should (= 0 (should (= 0
(call-process (concat invocation-directory invocation-name) (call-process (concat invocation-directory invocation-name)
nil nil nil nil nil nil
"-Q" ;; "--batch" "-Q" "--batch"
"-L" "." "-l" fixture-el-file))))) "-L" "." "-l" fixture-el-file)))))
(ert-deftest middle-of-buffer-snippet-insertion () (ert-deftest middle-of-buffer-snippet-insertion ()
@ -325,10 +331,10 @@ TODO: correct this bug!"
;; saving all definitions before overriding anything ensures FDEFINITION ;; saving all definitions before overriding anything ensures FDEFINITION
;; errors don't cause accidental permanent redefinitions. ;; errors don't cause accidental permanent redefinitions.
;; ;;
(cl-flet ((set-fdefinitions (names functions) (cl-labels ((set-fdefinitions (names functions)
(loop for name in names (loop for name in names
for fn in functions for fn in functions
do (fset name fn)))) do (fset name fn))))
(set-fdefinitions definition-names overriding-functions) (set-fdefinitions definition-names overriding-functions)
(unwind-protect (funcall function) (unwind-protect (funcall function)
(set-fdefinitions definition-names saved-functions))))) (set-fdefinitions definition-names saved-functions)))))
@ -409,12 +415,14 @@ TODO: correct this bug!"
(yas-reload-all) (yas-reload-all)
(with-temp-buffer (with-temp-buffer
(let* ((major-mode 'c-mode) (let* ((major-mode 'c-mode)
(expected '(c-mode (expected `(c-mode
cc-mode cc-mode
yet-another-c-mode yet-another-c-mode
and-also-this-one and-also-this-one
and-that-one and-that-one
prog-mode ;; prog-mode doesn't exit in emacs 24.3
,@(if (fboundp 'prog-mode)
'(prog-mode))
emacs-lisp-mode emacs-lisp-mode
lisp-interaction-mode)) lisp-interaction-mode))
(observed (yas--modes-to-activate))) (observed (yas--modes-to-activate)))
@ -627,15 +635,6 @@ add the snippets associated with the given mode."
;;; Helpers ;;; 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) (defun yas-should-expand (keys-and-expansions)
(dolist (key-and-expansion keys-and-expansions) (dolist (key-and-expansion keys-and-expansions)
(yas-exit-all-snippets) (yas-exit-all-snippets)

View File

@ -130,6 +130,8 @@
;;; Code: ;;; Code:
(require 'cl) (require 'cl)
(eval-and-compile
(require 'cl-lib))
(require 'easymenu) (require 'easymenu)
(require 'help-mode) (require 'help-mode)