mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2025-01-14 07:00:32 -05:00
guix: emacs-utils: Add ert-number-tests.
* guix/build/utils.scm (ert-number-tests): New variable.
This commit is contained in:
parent
1fcf9c0d7d
commit
50b2db40ea
1 changed files with 14 additions and 0 deletions
|
@ -40,6 +40,7 @@ (define-module (guix build emacs-utils)
|
||||||
emacs-byte-compile-directory
|
emacs-byte-compile-directory
|
||||||
emacs-compile-directory
|
emacs-compile-directory
|
||||||
emacs-header-parse
|
emacs-header-parse
|
||||||
|
ert-number-tests
|
||||||
|
|
||||||
as-display
|
as-display
|
||||||
emacs-substitute-sexps
|
emacs-substitute-sexps
|
||||||
|
@ -183,6 +184,19 @@ (define-syntax replacement-helper
|
||||||
(insert " ")
|
(insert " ")
|
||||||
(insert ,(format #f "~s" replacement))))))
|
(insert ,(format #f "~s" replacement))))))
|
||||||
|
|
||||||
|
(define (ert-number-tests file test-name)
|
||||||
|
"Add a numerically increasing suffix to tests of the same name.
|
||||||
|
This fixes test errors of the pattern \"Test TEST_NAME redefined\"."
|
||||||
|
(emacs-batch-edit-file file
|
||||||
|
`(let ((i 0))
|
||||||
|
(while (re-search-forward ,(string-append "ert-deftest " test-name)
|
||||||
|
nil t)
|
||||||
|
(goto-char (match-beginning 0))
|
||||||
|
(kill-region (match-beginning 0) (match-end 0))
|
||||||
|
(insert (format "ert-deftest %s-%d" ,test-name i))
|
||||||
|
(setq i (+ i 1)))
|
||||||
|
(basic-save-buffer))))
|
||||||
|
|
||||||
(define-syntax emacs-substitute-sexps
|
(define-syntax emacs-substitute-sexps
|
||||||
(syntax-rules ()
|
(syntax-rules ()
|
||||||
"Substitute the S-expression immediately following the first occurrence of
|
"Substitute the S-expression immediately following the first occurrence of
|
||||||
|
|
Loading…
Reference in a new issue