summaryrefslogtreecommitdiff
path: root/lisp/ldg-test.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/ldg-test.el')
-rw-r--r--lisp/ldg-test.el27
1 files changed, 27 insertions, 0 deletions
diff --git a/lisp/ldg-test.el b/lisp/ldg-test.el
index dbba9546..0c571caa 100644
--- a/lisp/ldg-test.el
+++ b/lisp/ldg-test.el
@@ -33,6 +33,33 @@
:type 'file
:group 'ledger-test)
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+(defun ledger-create-test ()
+ "Create a regression test."
+ (interactive)
+ (save-restriction
+ (org-narrow-to-subtree)
+ (save-excursion
+ (let (text beg)
+ (goto-char (point-min))
+ (forward-line 1)
+ (setq beg (point))
+ (search-forward ":PROPERTIES:")
+ (goto-char (line-beginning-position))
+ (setq text (buffer-substring-no-properties beg (point)))
+ (goto-char (point-min))
+ (re-search-forward ":ID:\\s-+\\([^-]+\\)")
+ (find-file-other-window
+ (format "~/src/ledger/test/regress/%s.test" (match-string 1)))
+ (sit-for 0)
+ (insert text)
+ (goto-char (point-min))
+ (while (not (eobp))
+ (goto-char (line-beginning-position))
+ (delete-char 3)
+ (forward-line 1))))))
+
(defun ledger-test-org-narrow-to-entry ()
(outline-back-to-heading)
(narrow-to-region (point) (progn (outline-next-heading) (point)))