Skip to content

Commit 96b5c4c

Browse files
svetlyak40wtmdbergmann
authored andcommitted
Added docstring.
1 parent 6bf0f4f commit 96b5c4c

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

tests/test-utils.lisp

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,35 @@
2828

2929

3030
(defmacro parametrized-test (name ((&rest parameter-names) &rest parameter-tuples) &body body)
31+
"Generates a separate tests for each parameter combination.
32+
33+
- NAME is the prefix for all tests in the group. The rest of each test name consists of parameters and values.
34+
- PARAMETER-NAMES should be a list of symbolic names of variables to be bound during BODY execution.
35+
- PARAMETER-TUPLES should be a list of lists of values to be bound to variables given in PARAMETER-NAMES.
36+
37+
Example:
38+
39+
(parametrized-test bt-box-test
40+
((withreply-p timeout)
41+
(nil nil)
42+
(t 1)
43+
(t nil))
44+
45+
(do-something with-reply-p timeout))
46+
47+
This form will be expanded to the code which will remove all 5AM tests starting with BT-BOX-TEST-
48+
and then will create 3 tests like this one:
49+
50+
51+
(test |BT-BOX-TEST-[WITHREPLY-P=T TIMEOUT=1]|
52+
(let ((withreply-p t) (timeout 1))
53+
(do-something with-reply-p timeout)))
54+
55+
As you can see, this test binds WITHREPLY-P and TIMEOUT variables to a values given in the second row of PARAMETER-TUPLES.
56+
57+
Name of each test will include parameter variables for this test. This way it will be easy to tell which parameter combination
58+
fails.
59+
"
3160
(multiple-value-bind (forms decls docstring)
3261
(parse-body body :documentation t :whole name)
3362
(let* ((docstring (or docstring ""))

0 commit comments

Comments
 (0)