Skip to content

Commit

Permalink
changed makefile test rules
Browse files Browse the repository at this point in the history
* test/run-test.sh: add. invoke unit test for each emacsen

* Makefile (check): add check rule.
  • Loading branch information
hayamiz committed Dec 27, 2009
1 parent e490cc3 commit 0690871
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 13 deletions.
7 changes: 7 additions & 0 deletions ChangeLog
@@ -1,5 +1,12 @@
2009-12-27 Yuto Hayamizu <y.hayamizu@gmail.com>

* test/run-test.sh: add. invoke unit test for each emacsen

* Makefile (check): add check rule.

* test/el-test-runner.el (twittering-run-test): exit with
appropriate status code.

* test.el (test-transform-body): add. transforms the body of
`defcase' recursively
(defcase): use `test-transform-body'
Expand Down
16 changes: 3 additions & 13 deletions Makefile
@@ -1,25 +1,15 @@

EMACS ?= emacs

.PHONY: all unit-test clean update-po
.PHONY: all clean update-po check

all:

update-po:
$(MAKE) -C doc update-po

# batchtest : twittering-mode.el
# $(EMACS21) --no-init-file --batch -f batch-byte-compile twittering-mode.el
# rm twittering-mode.elc
# $(EMACS22) --no-init-file --batch -f batch-byte-compile twittering-mode.el
# rm twittering-mode.elc
#
# test : twittering-mode.el
# $(EMACS21) -q -l local.test-emacs21.el &
# $(EMACS22) -q -l local.test-emacs22.el &

unit-test: test/run-test.el
$(EMACS) --batch -Q -l $<
check:
./test/run-test.sh

clean :
rm twittering-mode.elc
3 changes: 3 additions & 0 deletions test.el
Expand Up @@ -307,6 +307,7 @@ expressions"
(dolist (case-name (test-args-to-list cases))
(funcall (gethash case-name test-cases))))

(defvar test-last-summary nil)
(defun test-run-and-summarize (cases)
"Run test cases in CASES and print summary."
(let ((total-succ 0)
Expand All @@ -315,6 +316,8 @@ expressions"
(let ((summary (funcall (gethash case-name test-cases))))
(incf total-succ (car summary))
(incf total-fail (cadr summary))))
(setq test-last-summary
`((succ . ,total-succ) (fail . ,total-fail)))
(princ "# ")
(princ (format "Total: %d pass, %d fail." total-succ total-fail))))

Expand Down
8 changes: 8 additions & 0 deletions test/run-test.sh
Expand Up @@ -3,5 +3,13 @@
emacsen="emacs23 emacs22 emacs21"

for emacs in $(echo ${emacsen}); do
if ! which $emacs 1> /dev/null 2> /dev/null; then
echo "No such executable found: ${emacs}: skipped."
continue
fi
$emacs -q --no-site-file --batch --load $(dirname $0)/el-test-runner.el
if [ $? != 0 ]; then
echo "Test failed on $(${emacs} --version | head -n 1)"
exit 1
fi
done

0 comments on commit 0690871

Please sign in to comment.