Unverified Commit 5821cd06 authored by Jorgen Schäfer's avatar Jorgen Schäfer Committed by GitHub

Merge pull request #131 from snogge/markdown

Add more markdown running functions
parents bc13b53d 63306108
......@@ -1282,18 +1282,26 @@ current directory."
(buttercup-run)))
;;;###autoload
(defun buttercup-run-markdown ()
"Run all test suites defined in Markdown files passed as arguments.
A suite must be defined within a Markdown \"lisp\" code block."
(let ((lisp-buffer (generate-new-buffer "elisp")))
(dolist (file command-line-args-left)
(with-current-buffer (find-file-noselect file)
(goto-char (point-min))
(let ((case-fold-search t))
(while (re-search-forward
"```\\(?:emacs-\\|e\\)?lisp\n\\(\\(?:.\\|\n\\)*?\\)```"
nil t)
(let ((code (match-string 1)))
(defun buttercup-run-markdown-buffer (&rest markdown-buffers)
"Run all test suites defined in MARKDOWN-BUFFERS.
A suite must be defined within a Markdown \"lisp\" code block.
If MARKDOWN-BUFFERS is empty (nil), use the current buffer."
(interactive)
(unless markdown-buffers
(setq markdown-buffers (list (current-buffer))))
(let ((lisp-buffer (generate-new-buffer "elisp"))
(case-fold-search t)
code
buttercup-suites)
(dolist (markdown-buffer markdown-buffers)
(with-current-buffer markdown-buffer
(save-excursion
(save-match-data
(goto-char (point-min))
(while (re-search-forward
"```\\(?:emacs-\\|e\\)?lisp\n\\(\\(?:.\\|\n\\)*?\\)```"
nil t)
(setq code (match-string 1))
(with-current-buffer lisp-buffer
(insert code)))))))
(with-current-buffer lisp-buffer
......@@ -1302,6 +1310,20 @@ A suite must be defined within a Markdown \"lisp\" code block."
(point-max)))
(buttercup-run)))
;;;###autoload
(defun buttercup-run-markdown ()
"Run all test suites defined in Markdown files passed as arguments.
A suite must be defined within a Markdown \"lisp\" code block."
(apply #'buttercup-run-markdown-buffer (mapcar #'find-file-noselect
command-line-args-left)))
;;;###autoload
(defun buttercup-run-markdown-file (file)
"Run all test suites defined in Markdown FILE.
A suite must be defined within a Markdown \"lisp\" code block."
(interactive "fMarkdown file: ")
(buttercup-run-markdown-buffer (find-file-noselect file)))
(eval-when-compile
;; Defined below in a dedicated section
(defvar buttercup-reporter))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment