1 ;; -*- mode: lisp; syntax: common-lisp; coding: utf-8-unix; package: cl-mock-tests; -*-
3 (in-package #:cl-mock-tests)
7 (def-test call-with-mocks.empty ()
8 (is (eq T (with-mocks () T))))
10 (def-test call-with-mocks.discards-values ()
17 (declaim (notinline foo/simple))
19 (fail "original function binding ~A was called" 'foo/simple))
21 (def-test call-with-mocks.simple ()
23 (register-mock 'foo/simple)
27 (declaim (notinline foo bar))
31 (def-test call-with-mocks.default-values ()
34 (is (null (multiple-value-list (foo))))))
36 (def-test if-called.simple ()
38 (if-called 'foo (constantly 42))
41 (def-test invocations.length ()
45 (is (eql 3 (length (invocations))))))
47 (def-test invocations.arguments ()
52 (is (equal `((foo ,sym)) (invocations))))))
54 (def-test invocations.name ()
60 (is (equal `((foo)) (invocations 'foo)))))