test/utils.lisp @ 3325913a9b16

Add `put-void`

Not sure what I was thinking before -- we definitely need this instruction.
author Steve Losh <steve@stevelosh.com>
date Fri, 22 Jul 2016 20:32:51 +0000
parents aacf9ee4fddc
children 4abb7eda96cb
(in-package #:bones-test.utils)


;;;; Utils
(defun result= (x y)
  (set-equal (plist-alist x)
             (plist-alist y)
             :test #'equal))

(defun results= (r1 r2)
  (set-equal r1 r2 :test #'result=))


(defmacro should-fail (&body queries)
  `(progn
     ,@(loop :for query :in queries :collect
             `(is (results= nil (query-all ,query))))))

(defmacro should-return (&body queries)
  `(progn
    ,@(loop :for (query . results) :in queries
            :collect
            `(is (results= ',(cond
                               ((equal results '(empty))
                                (list nil))
                               ((equal results '(fail))
                                nil)
                               (t results))
                           (query-all ,query))))))