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 semicolon, an open parens).
As an example, the user would type
select and when they press the space key, the buffer would now contain
I'm having a hard time writing a test for this with ert. I've tried writing it thus:
(ert-deftest upcase-select () (with-temp-buffer (sqlup-mode) (insert "select") (execute-kbd-macro (kbd "SPC")) (should (equal (buffer-string) "SELECT "))))
This test should verify that when I press the space key, the word
"select" becomes the word
SELECT But the test ends up comparing
" " and
How can I write a test that triggers the behavior I desire?
(and further: is this a terrible idea? what's a better idea?)