Function: erts-run-test
erts-run-test is an interactive and byte-compiled function defined in
erts-mode.el.gz.
Signature
(erts-run-test TEST-FUNCTION &optional VERBOSE)
Documentation
Run the current test.
If the current erts file doesn't define a test function, the user will be prompted for one.
If VERBOSE (interactively, the prefix), display a diff of the expected results and the actual results in a separate buffer.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/progmodes/erts-mode.el.gz
(defun erts-run-test (test-function &optional verbose)
"Run the current test.
If the current erts file doesn't define a test function, the user
will be prompted for one.
If VERBOSE (interactively, the prefix), display a diff of the
expected results and the actual results in a separate buffer."
(interactive
(list (or (erts-mode--preceding-spec "Code")
(read-string "Transformation function: "))
current-prefix-arg)
erts-mode)
(save-excursion
(erts-mode--goto-start-of-test)
(condition-case arg
(ert-test--erts-test
(list (cons 'dummy t)
(cons 'code (car (read-from-string test-function)))
(cons 'point-char (save-match-data
(erts-mode--preceding-spec "Point-Char"))))
(buffer-file-name))
(:success (message "Test successful"))
(ert-test-failed
(if (not verbose)
(message "Test failure; result: \n%s"
(substring-no-properties (cadr (cadr arg))))
(message "Test failure")
(let (expected got)
(unwind-protect
(progn
(with-current-buffer
(setq expected (generate-new-buffer "erts expected"))
(insert (nth 1 (cadr arg))))
(with-current-buffer
(setq got (generate-new-buffer "erts results"))
(insert (nth 2 (cadr arg))))
(diff-buffers expected got))
(kill-buffer expected)
(kill-buffer got))))))))