run-test.el

HOME > Go Emacs > Test
日本語
Last modified: Fri Oct 31 10:54:03 +0900 2008

What's this?

This supports running tests on Emacs. run-test-setting.el is an example Emacs-Lisp for run-test.el setting.

Install

In this page, it shows that an example that we run tests for Gauche written with GaUnit. But we can use run-test.el with other testing framework like Ruby's Test::Unit, Python's Pikzie, C's Cutter and so on.

Added below to your .emacs.

(setq load-path (cons directory-where-has-run-test{,-setting}.el load-path))
(load "run-test-setting")

Write run-test.scm that runs tests. For example, like this.

#!/usr/bin/env gosh

(add-load-path ".")

(use test.unit)

(define base-dir (sys-dirname *program-name*))
(for-each load (glob #`",|base-dir|/**/test-*.scm"))

Change mode of run-test.scm to be executable.

Make your test files under directory that name is `test'.

topdir --- test --- run-test.scm
                 |
                 +- test-hoge.scm
                 |
                 .
                 .
                 .
                 |
                 +- test-fuga.scm

Test runner (run-test.scm) is invoked in topdir. That is like below.

% test/run-test.sh

Note above thins when you write run-test.scm.

Setting is finished.

You can execute topdir/test/run-test.sh by C-cC-t (run-test) in directory that under topdir. Excecuted result is inserted to the *run-test* buffer. You can jump to failure or error line by C-x`.

Happy testing!!

run-test.el has more information like customize variables.