[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
test-suite
From: |
Dirk Herrmann |
Subject: |
test-suite |
Date: |
Thu, 1 Mar 2001 01:05:58 +0100 (MET) |
Hello everybody.
Based on Thi's initiative to provide some more tests for guile's
test-suite (thanks!, especially for finding a set of bugs :-), I have
changed the module (test-suite lib) to provide some additional macros that
are meant to make writing tests easier:
;;;; Convenience macros to test for exceptions
;;;;
;;;; The following macros take exception parameters which are pairs
;;;; (type . message), where type is a symbol that denotes an exception type
;;;; like 'wrong-type-arg or 'out-of-range, and message is a string holding a
;;;; regular expression that describes the error message for the exception
;;;; like "Argument .* out of range".
;;;;
;;;; * (pass-if-exception name exception body) will pass if the execution of
;;;; body causes the given exception to be thrown. If no exception is
;;;; thrown, the test fails. If some other exception is thrown, is is an
;;;; error.
;;;; * (expect-fail-exception name exception body) will pass unexpectedly if
;;;; the execution of body causes the given exception to be thrown. If no
;;;; exception is thrown, the test fails expectedly. If some other
;;;; exception is thrown, it is an error.
The macros pass-if-exception and expect-fail-exception are basically a
generalization of the concept provided by Thi. Some minor differences:
An exception is characterized as a pair (type . message) instead of just a
message string. Further, with the additional form expect-fail-exception
it is possible to express that it is expected that the error reporting
will fail. Therefore, the test-suite does not currently report any
unexpected failures, but the number of expected failures has increased.
(not sure whether to put a smiley of a frowney behind that sentence.)
What still misses is a convenient way to express that for some code guile
should throw a certain exception, but guile does throw some other
exception which does not actually fit to the situation. This is also a
kind of expected failure, because the error reporting mechanism should be
fixed in such a case. If there is not objection, I will provide an
additional macro expect-fail-false-exception:
;;;; * (expect-fail-false-exception name exception f-exception body) will pass
;;;; unexpectedly if the execution of body causes exception to be thrown.
;;;; It will fail expectedly if f-exception is thrown. If no exception is
;;;; thrown, the test is unresolved. If some other exception is thrown, it
;;;; is an error.
Best regards,
Dirk Herrmann
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- test-suite,
Dirk Herrmann <=