diff options
author | Craig Earls <enderw88@gmail.com> | 2013-07-02 15:37:33 -0700 |
---|---|---|
committer | Craig Earls <enderw88@gmail.com> | 2013-07-02 15:37:33 -0700 |
commit | 63ba45dbaab04722cd59bf610ae77b8334ca213d (patch) | |
tree | bd0b1b22729a38b99d24bc1b1bc490a42e3acf53 /lisp/ldg-test.el | |
parent | 5b8817c8e8bb7524734d7f39ab6a170b856c6e90 (diff) | |
download | fork-ledger-63ba45dbaab04722cd59bf610ae77b8334ca213d.tar.gz fork-ledger-63ba45dbaab04722cd59bf610ae77b8334ca213d.tar.bz2 fork-ledger-63ba45dbaab04722cd59bf610ae77b8334ca213d.zip |
Finished changing name to ledger-*
All files and references changed ldg-* to ledger-*
Diffstat (limited to 'lisp/ldg-test.el')
-rw-r--r-- | lisp/ldg-test.el | 127 |
1 files changed, 0 insertions, 127 deletions
diff --git a/lisp/ldg-test.el b/lisp/ldg-test.el deleted file mode 100644 index 0c571caa..00000000 --- a/lisp/ldg-test.el +++ /dev/null @@ -1,127 +0,0 @@ -;;; ldg-test.el --- Helper code for use with the "ledger" command-line tool - -;; Copyright (C) 2003-2013 John Wiegley (johnw AT gnu DOT org) - -;; This file is not part of GNU Emacs. - -;; This is free software; you can redistribute it and/or modify it under -;; the terms of the GNU General Public License as published by the Free -;; Software Foundation; either version 2, or (at your option) any later -;; version. -;; -;; This is distributed in the hope that it will be useful, but WITHOUT -;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -;; FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -;; for more details. -;; -;; You should have received a copy of the GNU General Public License -;; along with GNU Emacs; see the file COPYING. If not, write to the -;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, -;; MA 02111-1307, USA. - -(defgroup ledger-test nil - "Definitions for the Ledger testing framework" - :group 'ledger) - -(defcustom ledger-source-directory "~/ledger/" - "Directory where the Ledger sources are located." - :type 'directory - :group 'ledger-test) - -(defcustom ledger-test-binary "/Products/ledger/debug/ledger" - "Directory where the Ledger debug binary is located." - :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))) - (goto-char (point-min))) - -(defun ledger-test-create () - (interactive) - (let ((uuid (org-entry-get (point) "ID"))) - (when (string-match "\\`\\([^-]+\\)-" uuid) - (let ((prefix (match-string 1 uuid)) - input output) - (save-restriction - (ledger-test-org-narrow-to-entry) - (goto-char (point-min)) - (while (re-search-forward "#\\+begin_src ledger" nil t) - (goto-char (match-end 0)) - (forward-line 1) - (let ((beg (point))) - (re-search-forward "#\\+end_src") - (setq input - (concat (or input "") - (buffer-substring beg (match-beginning 0)))))) - (goto-char (point-min)) - (while (re-search-forward ":OUTPUT:" nil t) - (goto-char (match-end 0)) - (forward-line 1) - (let ((beg (point))) - (re-search-forward ":END:") - (setq output - (concat (or output "") - (buffer-substring beg (match-beginning 0))))))) - (find-file-other-window - (expand-file-name (concat prefix ".test") - (expand-file-name "test/regress" - ledger-source-directory))) - (ledger-mode) - (if input - (insert input) - (insert "2012-03-17 Payee\n") - (insert " Expenses:Food $20\n") - (insert " Assets:Cash\n")) - (insert "\ntest reg\n") - (if output - (insert output)) - (insert "end test\n"))))) - -(defun ledger-test-run () - (interactive) - (save-excursion - (goto-char (point-min)) - (when (re-search-forward "^test \\(.+?\\)\\( ->.*\\)?$" nil t) - (let ((command (expand-file-name ledger-test-binary)) - (args (format "--args-only --columns=80 --no-color -f \"%s\" %s" - buffer-file-name (match-string 1)))) - (setq args (replace-regexp-in-string "\\$sourcepath" - ledger-source-directory args)) - (kill-new args) - (message "Testing: ledger %s" args) - (let ((prev-directory default-directory)) - (cd ledger-source-directory) - (unwind-protect - (async-shell-command (format "\"%s\" %s" command args)) - (cd prev-directory))))))) - -(provide 'ldg-test) |