One idea might be to save a copy of the current buffer, run the tests, and then run a diff command on them.
(defun run-tests ()
(copy-to-buffer "*my-test*" (point-min) (point-max))
(diff-buffers "*my-test*" (current-buffer)))
This will make a new buffer showing the diff (if any). There are ...
This is expected behavior, but you can circumvent this problem by let-binding executing-kbd-macro to t, which will convince the minibuffer commands to read from unread-command-events rather than from stdin.