Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [ert]

ERT is a tool for automated testing in Emacs Lisp. Its main features are facilities for defining tests, running them and reporting the results, and for debugging test failures interactively.

1
vote
1answer
23 views

Why is check-ert output cut at 70 characters column?

Sometimes when packaging emacs packages for Debian, I need to debug test failures. Then the debugging output is cut at 70 characters like in this bug report: https://bugs.debian.org/cgi-bin/bugreport....
0
votes
1answer
25 views

Using equal-including-properties to compare # string and propertized string

I'm writing some tests for my first emacs package but am running into an issue to do with asserting that two text properties are the same - one that's created with # and another with propertize: ;; ...
2
votes
1answer
80 views

Why does this function stub not work using cl-letf?

I have written this simple function and I want to stub out the last functions so I don't actually launch a process. (defun dc-test-stub-process (command &rest params) (interactive) (let ((...
4
votes
1answer
117 views

Stop ERT results frame from stealing focus

I've set up ert test results to display in a separate frame, if one exists, and in a bottom side-window otherwise: (add-to-list 'display-buffer-alist '("\\`\\*ert\\*\\'" (...
1
vote
1answer
84 views

Why does running my tests with ert-run-tests-batch-and-exit fail

I have written a few simple tests, when I run them on the buffer inside emacs everything passes. However, when I run them in batch mode as shown below, it fails. What can explain this? emacs -batch -...
1
vote
1answer
85 views

ERT: should-error doesn't catch failed assertions

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 ...
5
votes
2answers
286 views

run a single ERT test programmatically

I'm trying to write a piece of code that runs a single ERT test programmatically. In the ERT manual, they show an example that creates a test body and then runs the body, like so: (ert-deftest ert-...
3
votes
2answers
140 views

Where should my ERT tests go?

I'm new to using ERT for testing my Elisp code, and I have a question that doesn't seem to be covered in the manual: according to best practices, where does one typically put the ERT tests? Do they go ...
1
vote
1answer
206 views

What is ERT for?

I'm still a little confused about ERT. Is it for running regression tests of your elisp code or for running regression tests of other code too? For example would I run my JUnit tests under ERT, and ...
0
votes
2answers
105 views

How to get current file name when running under ERT?

I have a set of tests that involve loading files from the file-system and I would like to use the current filename to locate the test files relative to the test file. The below code shows the pattern ...
2
votes
2answers
83 views

Pending test in Ert

I'm currently starting to build a package the TDD way, and for that I'm using ert, following ert-runner opinions. I would like to write a set of pending tests, to identify what I have I to test, ...
1
vote
1answer
96 views

Why doesn't changing buffer in filter function have any effect in ERT?

I have a test for fsharp-mode to exercise the jump to definition functionality. Communicating with the background process involves sending a command and then letting the filter function handle the ...
1
vote
0answers
54 views

ert and elint: Use (eval-when-compile (ert-deftest …))?

I'm trying elint for the first time, because I just learned that it reports things that bytecode compiling doesn't. Mainly it is showing me a few missing requires, which I'm adding. Only a tests.el ...
4
votes
1answer
74 views

How can I test an idle timer with ERT?

Say I have a function that is called on an idle timer: (defun tmp:create () (mkdir "test")) (run-with-idle-time 3 nil #'tmp:create) How can I test that this function works? Using something like (...
0
votes
2answers
76 views

ERT with Emacs23

I'd like to use ERT with Emacs23. ERT is bundled with Emacs24. Latest version of ERT does not work with Emacs23 because of lack of define-error. Is there an offical way of using ERT with Emacs23?
2
votes
2answers
207 views

How can I skip a test if another test failed?

Say I have two tests: (defun func-one () nil) (defun func-two () (and (func-one) t)) (ert-deftest test-one () "Test basic functionality" (should (func-one))) (ert-deftest test-two () "Test ...
4
votes
4answers
332 views

writing tests for a post-self-insert-command hook

I wrote a minor mode with the purpose of modifying written text on the fly. It is currently creating a post-self-insert-command-hook, and triggers only on specific keypresses (e.g. the space bar, a ...
2
votes
1answer
63 views

Accessing resource files in ERT tests

I'm trying to use ERT to test the ycmd package, and part of what I need to do is pass bodies of code to the ycmd server and ask for completion candidates. I'd like to be able to keep these bodies of ...