This is the code that I made while following this chapter in gigamonkeys:
http://gigamonkeys.com/book/practical-building-a-unit-test-framework.html
The code:
(defun test-+()
; in here we are doing some funky format magic. The general idea here
; is that if the test fails (produces a NIL), then we print "FAIL".
; If there is a pass, then we print "pass". More information on this
; to follow!
(check
(= (+ 1 2) 3)
(= (+ 1 2 3) 6)
(= (+ -1 -3) -4)))
(defun report-result (result from)
(format t "~:[FAIL~;pass~] ... ~a~%" result from))
(defmacro check (&body forms)
`(progn
,@(loop for f in forms collect `(report-result ,f ',f))))
And this is the error that I'm getting:
[26]> (:cl "hello-world.lisp")
;; Compiling file /home/ashvets/Documents/Development/Lisp/hello-world/hello-world.lisp ...
*** - The macro CHECK may not be called with 3 arguments: (CHECK (= (+ 1 2) 3) (= (+ 1 2 3) 6) (= (+ -1 -3) -4))
The following restarts are available:
ABORT :R1 Abort main loop
Break 1 [27]> :q
0 errors, 0 warnings
I'm using Common Lisp. But why is it saying that I can't put in 3 arguments into check? I used &body.