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

Assertions are referred to as tests in cider-test #1627

Closed
bbatsov opened this issue Mar 21, 2016 · 6 comments
Closed

Assertions are referred to as tests in cider-test #1627

bbatsov opened this issue Mar 21, 2016 · 6 comments

Comments

@bbatsov
Copy link
Member

bbatsov commented Mar 21, 2016

I've noticed that in our messages we never use the term assertion, which is what lein uses extensively. I mean tests are composed of assertions:

(deftest error-handling-test
  (testing "Handles a fake error done via mocked function"
    (with-redefs [cider.nrepl.middleware.apropos/find-symbols
                  (fn [& args] (throw (Exception. "boom")))]
      (let [response (session/message {:op "apropos" :query "doesn't matter"})]
        (is (= (:status response) #{"apropos-error" "done"}))
        (is (= (:ex response) "class java.lang.Exception"))
        (is (.startsWith (:err response) "java.lang.Exception: boom")))))

  (testing "Handles a real error caused by an improper regular expression"
    (let [response (session/message {:op "apropos" :query "*illegal"})]
      (is (= (:status response) #{"apropos-regexp-error" "done"}))
      (is (.startsWith (:error-msg response) "Dangling")))))

This is one test with 5 assertions (is) in it. However, our message right now is:

cider.nrepl.middleware.apropos-test: Ran 5 tests. 0 failures, 0 errors.

It should be

cider.nrepl.middleware.apropos-test: Ran 1 test, 5 assertions. 0 failures, 0 errors.

@jeffvalk Was there a particular reason you avoided the term assertion?

@bbatsov
Copy link
Member Author

bbatsov commented Mar 21, 2016

And, of course, when running just a single test with C-c C-t t we should probably use a more specific message. E.g.:

cider.nrepl.middleware.apropos-test/error-handling-test: Ran 5 assertions. 0 failures, 0 errors.

@jeffvalk
Copy link
Contributor

No good reason. :-) I agree with you that "assertion" would be better here. Names are always a pain.

@bbatsov
Copy link
Member Author

bbatsov commented Mar 22, 2016

True that. I'll have to check if the middleware keeps track of both the number of tests and the number of assertions that were executed.

@jeffvalk
Copy link
Contributor

It does. What you're calling a test is currently var, and assertion is now test. In context, you can see how they got named this way.

@bbatsov
Copy link
Member Author

bbatsov commented Mar 24, 2016

Got it. That definitely makes sense and I don't might referring those as we do internally, but in the UI we should probably follow in lein's footsteps in terms of terminology.

@Malabarba
Copy link
Member

Indeed. I believe boot also follows the same terminology.

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

No branches or pull requests

4 participants