@@ -95,6 +95,8 @@ a derived class of `test-cockpit--engine'.")
95
95
:initform nil )
96
96
(last-args :initarg :last-args
97
97
:initform nil )
98
+ (last-interactive-cmd :initarg :last-interactive-cmd
99
+ :initform nil )
98
100
(is-dummy-engine :initarg :is-dummy-engine
99
101
:initform nil ))
100
102
" The base class for a test-cockpit engine.
@@ -208,6 +210,10 @@ The additional arguments are shipped as ARGS."
208
210
(oset engine last-function-string last-function))
209
211
(oset engine last-args args)))
210
212
213
+ (defun test-cockpit--update-last-interactive-command (function )
214
+ (let ((engine (test-cockpit--retrieve-engine)))
215
+ (oset engine last-interactive-cmd function)))
216
+
211
217
(defun test-cockpit--make-test-project-command (project-string args )
212
218
" Call the test-project-command function with ARGS of the current project type.
213
219
PROJECT-STRING is usually nil. The argument is here to make the function
@@ -228,7 +234,7 @@ FUNC-STRING is the string determining the function to test."
228
234
(test-cockpit--make-test-command
229
235
'test-cockpit--test-function-command func-string args))
230
236
231
- (defun test-cockpit-infix ()
237
+ (defun test-cockpit-- infix ()
232
238
" Call the infix function of the current project type and return the infix array."
233
239
(test-cockpit--transient-infix
234
240
(funcall (alist-get (projectile-project-type) test-cockpit--project-types))))
@@ -238,7 +244,7 @@ FUNC-STRING is the string determining the function to test."
238
244
(unless (equal (aref (transient-get-suffix 'test-cockpit-prefix '(0 )) 2 )
239
245
'(:description " Run test" ))
240
246
(transient-remove-suffix 'test-cockpit-prefix '(0 )))
241
- (if-let (infix (test-cockpit-infix))
247
+ (if-let (infix (test-cockpit-- infix))
242
248
(transient-insert-suffix 'test-cockpit-prefix '(0 ) infix)))
243
249
244
250
(defun test-cockpit--run-test (command )
@@ -268,6 +274,7 @@ ARGS is the UI state for language specific settings."
268
274
(list (transient-args 'test-cockpit-prefix )))
269
275
(test-cockpit--run-test
270
276
(test-cockpit--command 'test-cockpit--make-test-project-command nil args))
277
+ (test-cockpit--update-last-interactive-command 'test-cockpit-test-project )
271
278
(test-cockpit--update-last-commands args))
272
279
273
280
;;;### autoload
@@ -286,6 +293,7 @@ is tested."
286
293
(test-cockpit--command 'test-cockpit--make-test-module-command
287
294
module-string
288
295
args))
296
+ (test-cockpit--update-last-interactive-command 'test-cockpit-test-module )
289
297
(test-cockpit--update-last-commands args))
290
298
(message " Not in a unit test module file " )))
291
299
@@ -306,6 +314,7 @@ were in is tested."
306
314
(test-cockpit--command 'test-cockpit--make-test-function-command
307
315
function-string
308
316
args))
317
+ (test-cockpit--update-last-interactive-command 'test-cockpit-test-function )
309
318
(test-cockpit--update-last-commands args))
310
319
(message " Not in a unit test module file " )))
311
320
@@ -435,6 +444,18 @@ prompt to type a test command is shown."
435
444
(test-cockpit--repeat-projectile-test)
436
445
(test-cockpit-repeat-test)))
437
446
447
+
448
+ ;;;### autoload
449
+ (defun test-cockpit--repeat-interactive-test (&optional args )
450
+ " Repeat the last interactive test command.
451
+ This is not meant to be called directly but as a result the transient dispatch
452
+ in order to call the last test action with modified ARGS."
453
+ (interactive
454
+ (list (transient-args 'test-cockpit-prefix )))
455
+ (when-let ((last-cmd (test-cockpit--last-interactive-test-command)))
456
+ (funcall last-cmd args)))
457
+
458
+
438
459
(defun test-cockpit--projectile-build (&optional last-cmd )
439
460
" Launch a projectile driven build process.
440
461
If last executed command LAST-CMD is given the command is
@@ -497,6 +518,10 @@ repetition."
497
518
" Get the last switches stored in the current engine."
498
519
(oref (test-cockpit--retrieve-engine) last-switches))
499
520
521
+ (defun test-cockpit--last-interactive-test-command ()
522
+ " Get the last interactive test command."
523
+ (oref (test-cockpit--retrieve-engine) last-interactive-cmd))
524
+
500
525
(transient-define-prefix test-cockpit-prefix ()
501
526
" Test the project."
502
527
:value 'test-cockpit--last-switches
@@ -506,7 +531,7 @@ repetition."
506
531
" Setup the main menu common for all projects for testing."
507
532
(let ((module-string (or (test-cockpit--current-module-string) (test-cockpit--last-module-string)))
508
533
(function-string (or (test-cockpit--current-function-string) (test-cockpit--last-function-string)))
509
- (last-cmd (oref (test-cockpit--real-engine-or-error) last-command )))
534
+ (last-cmd (oref (test-cockpit--real-engine-or-error) last-interactive-cmd )))
510
535
(vconcat (remove nil (append `(" Run tests"
511
536
(" p" " project" test-cockpit-test-project)
512
537
,(if module-string
@@ -519,7 +544,7 @@ repetition."
519
544
test-cockpit-test-function))
520
545
(" c" " custom" test-cockpit-custom-test-command)
521
546
,(if last-cmd
522
- `(" r" " repeat" test-cockpit-repeat-test))))))))
547
+ `(" r" " repeat" test-cockpit-- repeat-interactive -test))))))))
523
548
524
549
(defun test-cockpit--strip-project-root (path )
525
550
" Strip the project root path from a given PATH."
0 commit comments