1

Today I'm trying out ERT for the first time.

(should-error (/ 1 0))

This works and returns (arith-error) as expected.

(should-error (cl-assert nil))

The assertion escapes the should-error and causes a stack trace.

What's the appropriate thing to do if I want to test code that uses cl-assert?

0

I asked this question on gnu.emacs.help and learned how to make this work:

(let ((debug-on-error nil)) (should-error (cl-assert nil)))

It seems cl-assert doesn't raise an error if debug-on-error is true, it just goes straight to the debugger.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.