4 ms·
I maintain an Emacs package that is fundamentally based around user interaction (called ido-completing-read+[1]). At some point I realized that I needed a test
by rcthompson 5y ago
I maintain an Emacs package that is fundamentally based around user interaction (called ido-completing-read+[1]). At some point I realized that I needed a test suite for it, but at the time there was no easy way to test Elisp code that reads user input without actual user interaction. So I wrote with-simulated-input[2], a package providing a macro of the same name that let you run a piece of code while supplying key sequence to feed to that code as if the user was typing those keys. So now my package centered around user input has a fully automated test suite, and that's pretty cool.
[1]: https://github.com/DarwinAwardWinner/ido-completing-read-plus https://github.com/DarwinAwardWinner/ido-completing-read-plu...
[2]: https://github.com/DarwinAwardWinner/with-simulated-input https://github.com/DarwinAwardWinner/with-simulated-input