DarwinAwardWinner / with-simulated-input

Test your interactive elisp functions non-interactively!
GNU General Public License v3.0
38 stars 4 forks source link

Section "Running code during input" is too vague #20

Open doublep opened 4 weeks ago

doublep commented 4 weeks ago

In buffer *scratch* I typed this:

(with-simulated-input ("1" "2")
  (isearch-forward))

(with-simulated-input ("1" (ignore) "2")
  (isearch-forward))

1x

12

If I put the point at the end of the first form and type C-x C-e, it jumps to the end of the buffer, as expected: isearch-forward is launched and searches for string "12".

However, if I do the same with the second form (that with (ignore) inside), the point jumps into the middle of "1x". So, "2" apparently is never added to the search string. But, reading the documentation, I have expected that ("1" (ignore) "2") would be the same as `("1" "2"). Either the documentation is confusing, or something in the macro doesn't behave correctly.

doublep commented 4 weeks ago

Posted too early, sorry.

Another point. If I evaluate

(with-simulated-input ("1" (error "...") "2")
  (isearch-forward))

I cannot see the error anywhere, it is either eaten at some point or simply not evaluated. Usecase was to use ERT's macro (should ...) here, but I couldn't see its assertion failures anywhere, even if they were certainly generated, e.g. from (should nil).

DarwinAwardWinner commented 4 weeks ago

Hmm, this looks like a bug. I'll have to look into it.