For Gauche 0.9.7


Next: , Previous: , Up: Library modules - Utilities   [Contents][Index]

12.3 compat.chibi-test - Running Chibi-scheme test suite

Module: compat.chibi-test

Quite a few srfis come with test suites that’s to be run with Chibi Scheme test framework. This module enables Gauche to run the test code as is.

Macro: chibi-test code …

Run code …, while translating Chibi test framework to Gauche’s.

A typical usage is to write a wrapper that includes the original test code (suppose it’s called test-suite.scm):

(use gauche.test)
(test-start "running test-suite.scm")
(chibi-test
  (include "test-suite.scm"))
(test-end)

Chibi’s test directives are translated to Gauche’s test directives (see Unit testing, for Gauche’s test framework).

The main thing is that Chibi allows expressions and definitions to be intermingled within a body, while Gauche only allows all definitions before expressions within a body. We expand such body into nested let by chibi-test macro. Chibi test macros (e.g. test-assert) are defined as local macros in chibi-test expansion, which expand into gauche.test macros.

Note that we ignore use forms inside chibi-test; we might want to use different modules that work better in Gauche. Necessary modules need to be use’d before you call chibi-test.

You may want to check out test/srfi.scm in Gauche source tree for the use case.


Next: , Previous: , Up: Library modules - Utilities   [Contents][Index]