Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Q: how to perform tests in src file #11

Open
mirkov opened this issue Nov 6, 2018 · 0 comments
Open

Q: how to perform tests in src file #11

mirkov opened this issue Nov 6, 2018 · 0 comments

Comments

@mirkov
Copy link

mirkov commented Nov 6, 2018

This is not an issue but a question:

In original lisp-unit I like to define tests for internal (unexpored function) below the function itself, in the same file. I use that for testing and for documentation.

Is that possible in lisp-unit2?

The following code demonstrates what I like to do in lisp-unit, and how I tried to achieve the same in lisp-unit2

(cl:in-package :cl-user)

(defpackage lu-example
  (:use :cl)
  (:documentation "Demonstrate that Lisp Unit test code can live in the same file and
  package as source code"))

(in-package :lu-example)

(defun foo () t)

(lu:define-test foo
    (lu:assert-true (foo)))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defpackage :lu2-example-1
  (:use :cl)
  (:documentation "Demonstrate conflicts when I try to have Lisp Unit2 test code in the
  same file and package."))

(in-package :lu2-example-1)

(defun foo () t)

;; I am not surprised by this failure
(lisp-unit2:define-test foo () 
    (lisp-unit2:assert-true (foo)))

(defpackage :lu2-example-1.test
  (:use :cl)
  (:documentation "Lisp Unit 2 test package.  I will try to place test code in that
  package, but in the same file"))

;; I was hoping that this would work
(lisp-unit2:define-test foo (:package :lu2-example-1)
    (lisp-unit2:assert-true (foo)))

Thank you,

Mirko

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant