Skip to main content

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.

Filter by
Sorted by
Tagged with
1 vote
1 answer
26 views

How to test for Warning using ERT?

I want to check for a warning but not sure how to go about it. My warning is: Warning (my-func-file-not-found): /path/to/somefile.txt This is created with display-warning 'my-func-file-not-found. I ...
ritchie's user avatar
  • 169
1 vote
0 answers
33 views

How to impose a timeout on ert tests?

When using ert I'd sometimes like to have tests abort after some timeout. I could program this in advance in the test-case but this is not what I need. Imagine a situation where I use ert-run-tests-...
phs's user avatar
  • 1,239
1 vote
1 answer
54 views

Enforce order of ERT tests?

When running ert tests, the seem to be run by default in string< order. For instance running tests (require 'ert) (ert-deftest t1111 () (print 'AAAA)) (ert-deftest t3333 () (print 'BBBB)) (ert-...
kdb's user avatar
  • 1,571
3 votes
1 answer
430 views

How to run "ert" tests?

What I tried: Cloned a package with ert tests (https://github.com/dgutov/robe ) # sidenote this package was previously installed using use-package emacs ~/robe/core-tests.el M-x ert Selector: t ...
american-ninja-warrior's user avatar
0 votes
1 answer
96 views

How do I let ert know where my tests are defined?

What I'm doing: If I define a test like: (ert-deftest tmp-test () "failing test" :expected-result :failed (should (eql (+ 1 0) 2))) and then I run M-x ert-run-tests-automatically ;; ...
user1854496's user avatar
0 votes
1 answer
210 views

Testing Emacs Lisp Code Involving Org Mode

I'm trying to figure out how I can use ERT and libraries like el-mock to test simple functions that manipulate my org-document. Consider a function like this: (defun promote-next-heading () (org-...
Beetle B.'s user avatar
  • 640
1 vote
1 answer
62 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....
Thomas Koch's user avatar
1 vote
1 answer
58 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: ;; ...
xdl's user avatar
  • 125
2 votes
1 answer
213 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 ((...
Oly's user avatar
  • 593
4 votes
1 answer
320 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\\*\\'" (...
ivan's user avatar
  • 1,948
1 vote
1 answer
195 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 -...
Oly's user avatar
  • 593
1 vote
1 answer
262 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 ...
Sean's user avatar
  • 941
7 votes
2 answers
705 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-...
Kevin's user avatar
  • 1,328
4 votes
2 answers
330 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 ...
Ryan C. Thompson's user avatar
3 votes
1 answer
394 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 ...
Jason Nordwick's user avatar
0 votes
2 answers
195 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 ...
rneatherway's user avatar
2 votes
2 answers
121 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, ...
AdrieanKhisbe's user avatar
1 vote
1 answer
144 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 ...
rneatherway's user avatar
0 votes
0 answers
114 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 ...
Greg Hendershott's user avatar
4 votes
1 answer
391 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 (...
Sean Allred's user avatar
  • 6,951
0 votes
2 answers
97 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?
Gracjan Polak's user avatar
2 votes
2 answers
269 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 ...
Sean Allred's user avatar
  • 6,951
4 votes
4 answers
519 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 ...
Trevoke's user avatar
  • 2,450
2 votes
1 answer
127 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 ...
abingham's user avatar
  • 927