help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

multiple conditions in ERT tests


From: Joost Kremers
Subject: multiple conditions in ERT tests
Date: 15 Dec 2014 12:20:27 GMT
User-agent: slrn/pre1.0.0-18 (Linux)

Hi all,

What is the best/canonical/recommended way to write a test for a
function that should do two things: return a certain value and move
point to a certain position. I'm wondering whether I should write:

,----
| (ert-deftest test-comment
|   (with-temp-buffer
|     (<set-up-buffer>)
|     (should (string= (<do-my-stuff>) "A comment"))
|     (should (= (point) 30))))
`----

or rather:

,----
| (ert-deftest test-comment
|   (with-temp-buffer
|     (<set-up-buffer>)
|     (should (and (string= (<do-my-stuff>) "A comment")
|                  (point) 30))))
`----

When I try them, both tests pass or fail in the same way AFAICT. I also
notice that the first method produces more readable failure reports, so
I suspect it's the way to go, but perhaps there's something I'm missing?

TIA


-- 
Joost Kremers                                   joostkremers@fastmail.fm
Selbst in die Unterwelt dringt durch Spalten Licht
EN:SiS(9)


reply via email to

[Prev in Thread] Current Thread [Next in Thread]