@@ -362,11 +362,12 @@ This second example illustrates the use of
362362        (turtles-with-grab-buffer (:name "initial prompt" :point "<>") 
363363          (should (equal "Choose: <>" (buffer-string)))) 
364364
365-         :keys "Ch TAB" 
365+         (execute-kbd-macro "Ch") 
366+         (minibuffer-complete) 
366367        (turtles-with-grab-buffer (:name "completion" :point "<>") 
367368          (should (equal "Choose: Choice <>" (buffer-string)))) 
368369
369-         :keys  "B")))) 
370+         (execute-kbd-macro  "B") )))) 
370371@end example 
371372
372373@code {turtles-with-minibuffer } takes as argument two separate sections, as shown below:
@@ -409,14 +410,12 @@ that manually; it’s just convenient to see the content and the
409410position of the point in the same string.
410411
411412This test interacts with @code {completing-read } by simulating the
412- user typing some text and pressing @code {TAB }. It uses @ref {10 ,,;keys } for that, which instructs the macro
413- @code {turtles-with-minibuffer } to simulates the user typing some
414- keys.
413+ user typing some text and pressing @code {TAB }.
415414
416415The test could have called the command @code {TAB } corresponds to directly:
417416
418417@example 
419- :keys  "Ch"
418+ (execute-kbd-macro  "Ch") 
420419(minibuffer-complete) 
421420(turtles-with-grab-buffer (:name "completion" :point "<>") 
422421  (should (equal "Choose: Choice <>" (buffer-string)))) 
@@ -426,9 +425,10 @@ Calling interactive commands in such a way in a test is usually
426425clearer than going through key bindings, and in most cases, it works well.
427426
428427Some commands that rely on the specific environment provided by the
429- command loop won’t work if called directly.
430- @ref {10 ,,;command } can help with such commands,
431- though it might be considered overkill here:
428+ command loop won’t work if called directly or even through
429+ @code {execute-kbd-macro }. @ref {10 ,,;keys  and  ;command } can
430+ help with such tricky commands. Though it would be overkill here, you
431+ could do:
432432
433433@example 
434434:keys "Ch" 
@@ -839,11 +839,12 @@ calls to @code{turtles-with-grab-buffer} to test the content of
839839the minibuffer or any other window.
840840
841841@item  
842- keys passed to the minibuffer, with :keys, see below.
842+ keys passed to the minibuffer, with (execute-kbd-macro) or :keys (see
843+ below for :keys).
843844
844845@item  
845- commands that manipulate the minibuffer, either  called directly
846- or using :command,  see below.
846+ commands that manipulate the minibuffer, called directly, using 
847+ (ert-simulate-command)  or using :command ( see below for :command) .
847848@end itemize 
848849
849850At the end of BODY, the minibuffer is closed, if needed, and
@@ -855,6 +856,9 @@ events using the command loop. In contrast to @code{execute-kbd-macro},
855856function use the real event loop, triggered by real, external events
856857(terminal keys). This isn’t as simulation.
857858
859+ You can’t use these special form except directly in BODY. The
860+ following won’t work, for example: @code {(if  cond  :keys  "abc") }
861+ 
858862
859863@table  @asis 
860864
@@ -863,6 +867,9 @@ function use the real event loop, triggered by real, external events
863867This expression provides KEYS as user input to the minibuffer.
864868
865869KEYS is in the same format as passed to @code {kbd }.
870+ :command:
871+ 
872+ Prefer @code {(execute-kbd-macro) }, when it works.
866873
867874@item  :events events
868875
@@ -872,11 +879,16 @@ to the minibuffer.
872879This is more general than the previous function as the events
873880can be any kind of UI events.
874881
882+ Prefer @code {(execute-kbd-macro) }, when it works.
883+ 
875884@item  :command command
876885
877886This expression runs the given interactive command in the event
878887loop, triggered by a key stroke.
879888
889+ Prefer calling the command directly or through
890+ @code {(ert-simulate-command) }, when it works.
891+ 
880892@item  :command-with-keybinding keybinding command
881893
882894This expression works as above, but makes sure that the command
0 commit comments