From 346a578e2303a8c58192925d192fed44853b4988 Mon Sep 17 00:00:00 2001 From: Olof-Joachim Frahm Date: Mon, 10 Jun 2013 22:49:08 +0200 Subject: [PATCH] Better tests organization, ASDF integration. --- cl-mock.asd | 20 +++++++++++++++++++- tests/facade.lisp | 2 +- tests/functions.lisp | 2 ++ tests/methods.lisp | 2 +- tests/package.lisp | 3 ++- tests/suite.lisp | 3 +++ 6 files changed, 28 insertions(+), 4 deletions(-) create mode 100644 tests/suite.lisp diff --git a/cl-mock.asd b/cl-mock.asd index 6774d07..54861d6 100644 --- a/cl-mock.asd +++ b/cl-mock.asd @@ -8,8 +8,26 @@ :author "Olof-Joachim Frahm " :license "Simplified BSD License" :depends-on (#:closer-mop) + :in-order-to ((asdf:test-op (asdf:load-op #:cl-mock-tests))) + :perform (asdf:test-op :after (op c) + (funcall (find-symbol (symbol-name '#:run!) '#:fiveam) + (find-symbol (symbol-name '#:cl-mock) '#:cl-mock-tests))) :serial T :components ((:module "src" :components ((:file "package") - (:file "functions"))))) + (:file "functions") + (:file "mock") + (:file "methods") + (:file "facade"))))) + +(asdf:defsystem #:cl-mock-tests + :depends-on (#:cl-mock #:fiveam) + :serial T + :components ((:module "tests" + :components + ((:file "package") + (:file "suite") + (:file "functions") + (:file "facade") + (:file "methods"))))) diff --git a/tests/facade.lisp b/tests/facade.lisp index 86962a4..2eeeec8 100644 --- a/tests/facade.lisp +++ b/tests/facade.lisp @@ -2,7 +2,7 @@ (in-package #:cl-mock-tests) -(import 'cl-mock::(call-with-mocks make-mock-bindings register-mock if-called when-called call-previous)) +(in-suite cl-mock) (def-test call-with-mocks.empty () (is (eq T (call-with-mocks diff --git a/tests/functions.lisp b/tests/functions.lisp index d3acdc3..4b0a000 100644 --- a/tests/functions.lisp +++ b/tests/functions.lisp @@ -2,6 +2,8 @@ (in-package #:cl-mock-tests) +(in-suite cl-mock) + (def-test dflet.calls-binding () (dflet ((foo () 23)) (is (eql 23 (foo))))) diff --git a/tests/methods.lisp b/tests/methods.lisp index 36b7894..fa88e4a 100644 --- a/tests/methods.lisp +++ b/tests/methods.lisp @@ -2,7 +2,7 @@ (in-package #:cl-mock-tests) -(import 'cl-mock::(progm)) +(in-suite cl-mock) (defclass foo () ()) diff --git a/tests/package.lisp b/tests/package.lisp index fe62325..0faeab1 100644 --- a/tests/package.lisp +++ b/tests/package.lisp @@ -3,4 +3,5 @@ (in-package #:cl-user) (defpackage #:cl-mock-tests - (:use #:cl #:cl-mock #:fiveam)) + (:use #:cl #:cl-mock #:fiveam) + (:import-from #:cl-mock #:call-with-mocks #:progm #:make-mock-bindings #:if-called #:when-called)) diff --git a/tests/suite.lisp b/tests/suite.lisp new file mode 100644 index 0000000..04d89be --- /dev/null +++ b/tests/suite.lisp @@ -0,0 +1,3 @@ +(in-package #:cl-mock-tests) + +(def-suite cl-mock) -- 1.7.10.4