Function: ert-test-erts-file

ert-test-erts-file is a byte-compiled function defined in ert.el.gz.

Signature

(ert-test-erts-file FILE &optional TRANSFORM)

Documentation

Parse FILE as a file containing before/after parts (an erts file).

This function puts the "before" section of an .erts file into a temporary buffer, calls the TRANSFORM function, and then compares the result with the "after" section.

See Info node (ert) erts files for more information on how to write erts files.

Probably introduced at or before Emacs version 29.1.

Source Code

;; Defined in /usr/src/emacs/lisp/emacs-lisp/ert.el.gz
;;; erts files.

(defun ert-test-erts-file (file &optional transform)
  "Parse FILE as a file containing before/after parts (an erts file).

This function puts the \"before\" section of an .erts file into a
temporary buffer, calls the TRANSFORM function, and then compares
the result with the \"after\" section.

See Info node `(ert) erts files' for more information on how to
write erts files."
  (with-temp-buffer
    (insert-file-contents file)
    (let ((gen-specs (list (cons 'dummy t)
                           (cons 'code transform))))
      ;; Find the start of a test.
      (while (re-search-forward "^=-=\n" nil t)
        (setq gen-specs (ert-test--erts-test gen-specs file))
        ;; Search to the end of the test.
        (re-search-forward "^=-=-=\n")))))