Overhaul and version bump.
[cl-mock.git] / tests / facade.lisp
1 ;; -*- mode: lisp; syntax: common-lisp; coding: utf-8-unix; package: cl-mock-tests; -*-
2
3 (in-package #:cl-mock-tests)
4 \f
5 (in-suite cl-mock)
6
7 (def-test answer.simple ()
8   (with-mocks ()
9     (answer (foo 1) 42)
10     (answer foo 23)
11     (is (eql 42 (foo 1)))))
12
13 (def-test answer.literal ()
14   (with-mocks ()
15     (answer (foo 1) 2)
16     (answer (foo 2) 3)
17     (answer foo 42)
18     (is (eql 2 (foo 1)))
19     (is (eql 2 (foo 1)))
20     (is (eql 3 (foo 2)))
21     (is (eql 3 (foo 2)))
22     (is (eql 42 (foo)))
23     (is (eql 42 (foo 'foo)))))
24
25 (def-test answer.times ()
26   (with-mocks ()
27     (answer foo 1 2 3)
28     (is (eql 1 (foo)))
29     (is (eql 2 (foo)))
30     (is (eql 3 (foo)))
31     (is (eql 3 (foo)))))
32
33 (def-test answer.call-previous ()
34   (with-mocks ()
35     (answer foo 3 (call-previous))
36     (is (eql 3 (foo)))
37     (is (eq 'foo (foo)))))