Some ideas about rebinding methods.
[cl-mock.git] / tests / mock.lisp
index c935e8e..e6f8ec0 100644 (file)
     (register-mock 'bar)
     (foo)
     (bar)
-    (is (equal `((foo)) (invocations 'foo)))))
+    (is (equal '((foo)) (invocations 'foo)))))
+
+(def-test call-with-mocks.method.default-values ()
+  (with-mocks ()
+    (register-mock 'baz :method '(NIL (list)))
+    (is (null (multiple-value-list (baz NIL))))))
+
+(def-test invocations.method.simple ()
+  (with-mocks ()
+    (register-mock 'baz :method '(NIL (list)))
+    (is (typep #'baz 'generic-function))
+    (baz (list 1 2 3))
+    (is (equal '((baz (1 2 3))) (invocations)))))
+
+(def-test call-with-mocks.method.autodetection ()
+  (with-mocks ()
+    (register-mock 'baz)
+    (is (typep #'baz 'generic-function))
+    (baz (list 1 2 3))
+    (is (equal '((baz (1 2 3))) (invocations)))))