For Gauche 0.9.15Search (procedure/syntax/module):

Next: , Previous: , Up: ライブラリモジュール - SRFI   [Contents][Index]

11.15 srfi.64 - SchemeテストスイートAPI

Module: srfi.64

このモジュールはポータブルなテストスイートを書くAPIを提供します。 Gaucheでは、このsrfiはgauche.testと協調して動くようになっています (gauche.test - 単体テスト参照)。

gauche.testが有効な状態で、SRFI-64テストを走らせた場合、 それらのテストはgauche.testの一部として実行されます。

推奨されるテストの書き方は、ポータブルなテストをsrfi-64のみで書き、 Gaucheテストスクリプトから次のとおりincludeすることです。

(use gauche.test)
(test-start "the tests")
;; portable test
(include "test-suite-in-srfi-64")

;; gauche-specific test, if needed
...

(test-end)

test-suite-in-srfi-64.scmをそれ単独で走らせた場合は、 SRFI-64のデフォルトのテスト報告形式で結果が報告されます。 gauche.testスクリプトからincludeして走らせた場合は、 結果がgauche.testの報告形式を使って、他のGaucheテストと合わせて報告されます。


11.15.1 Test runner

In SRFI-64, tests are run with an active test runner which collects test results and emits reports. It allows users to provide custom runners to handle tailored reports suitable to the specific tests.

Test runner object

Record: test-runner

[SRFI-64]{srfi.64}

Function: test-runner? obj

[SRFI-64]{srfi.64}

Parameter: test-runner-current

[SRFI-64]{srfi.64}

Function: test-runner-get

[SRFI-64]{srfi.64}

Function: test-runner-simple

[SRFI-64]{srfi.64}

Function: test-runner-null

[SRFI-64]{srfi.64}

Function: test-runner-factory :optional factory

[SRFI-64]{srfi.64}

Running tests with a specified runner

Function: test-apply [runner] specifier … procedure

[SRFI-64]{srfi.64}

Macro: test-with-runner runner decl-or-expr …

[SRFI-64]{srfi.64}

Latest result properties

A runner holds a single alist to keep the latest result properties. Except the result-kind property, which is set by every basic test procedures, the usage of properties are up to the test runner and/or test writer.

Function: test-result-clear runner

[SRFI-64]{srfi.64}

Function: test-result-ref runner pname :optional default

[SRFI-64]{srfi.64}

Function: test-result-set! runnre pname value

[SRFI-64]{srfi.64}

Function: test-result-remove runner pname

[SRFI-64]{srfi.64}

Function: test-result-alist runner

[SRFI-64]{srfi.64}

Function: test-result-kind :optional runner

[SRFI-64]{srfi.64}

Function: test-passed? :optional runner

[SRFI-64]{srfi.64}

Keeping track of test status

Function: test-runner-pass-count runner
Function: test-runner-fail-count runner
Function: test-runner-xpass-count runner
Function: test-runner-xfail-count runner
Function: test-runner-skip-count runner

[SRFI-64]{srfi.64}

Function: test-runner-test-name runner

[SRFI-64]{srfi.64}

Function: test-runner-group-path runner

[SRFI-64]{srfi.64}

Function: test-runner-group-stack runner

[SRFI-64]{srfi.64}

Function: test-runner-aux-value runner
Function: test-runner-aux-value! runner value

[SRFI-64]{srfi.64}

Function: test-runner-reset runner

[SRFI-64]{srfi.64}

Callbacks

Function: test-runner-on-test-begin runner
Function: test-runner-on-test-begin! runner proc

[SRFI-64]{srfi.64}

Function: test-runner-on-test-end runner
Function: test-runner-on-test-end! runner proc

[SRFI-64]{srfi.64}

Function: test-runner-on-group-begin runner
Function: test-runner-on-group-begin! runner proc

[SRFI-64]{srfi.64}

Function: test-runner-on-group-end runner
Function: test-runner-on-group-end! runner proc

[SRFI-64]{srfi.64}

Function: test-runner-on-bad-count runner
Function: test-runner-on-bad-count! runner proc

[SRFI-64]{srfi.64}

Function: test-runner-on-bad-end-name runner
Function: test-runner-on-bad-end-name! runner proc

[SRFI-64]{srfi.64}

Function: test-runner-on-final runner
Function: test-runner-on-final! runner proc

[SRFI-64]{srfi.64}

Function: test-on-test-begin-simple runner
Function: test-on-test-end-simple runner
Function: test-on-group-begin-simple runner
Function: test-on-group-end-simple runner
Function: test-on-bad-count-simple runner actual-count expected-count
Function: test-on-bad-end-name-simple runner begin-name end-name

[SRFI-64]{srfi.64}


11.15.2 Test API

Test grouping

SRFI-64 tests can be grouped, and groups can be nested.

Function: test-begin suite-name :optional count

[SRFI-64]{srfi.64}

Function: test-end :optional suite-name

[SRFI-64]{srfi.64}

Function: test-group suite-name body …

[SRFI-64]{srfi.64}

Function: test-group-with-cleanup suite-name body … cleanup

[SRFI-64]{srfi.64}

Individual tests

Macro: test-assert [test-name] expr

[SRFI-64]{srfi.64}

Macro: test-eqv [test-name] expected test-expr
Macro: test-eq [test-name] expected test-expr
Macro: test-equal [test-name] expected test-expr

[SRFI-64]{srfi.64}

Macro: test-approximate [test-name] extected test-expr margin

[SRFI-64]{srfi.64}

Macro: test-error [[test-name] error-type] test-expr

[SRFI-64]{srfi.64}

Function: test-read-eval-string string

[SRFI-64]{srfi.64}


Next: , Previous: , Up: ライブラリモジュール - SRFI   [Contents][Index]


For Gauche 0.9.15Search (procedure/syntax/module):