|
| 1 | +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
| 2 | +;; This program is free software; you can redistribute it and/or |
| 3 | +;; modify it under the terms of the GNU General Public License as |
| 4 | +;; published by the Free Software Foundation; either version 2 of |
| 5 | +;; the License, or (at your option) any later version. |
| 6 | +;; |
| 7 | +;; This program is distributed in the hope that it will be useful, |
| 8 | +;; but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 9 | +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 10 | +;; GNU General Public License for more details. |
| 11 | +;; |
| 12 | +;; You should have received a copy of the GNU General Public License |
| 13 | +;; along with this program; if not, contact: |
| 14 | +;; |
| 15 | +;; Free Software Foundation Voice: +1-617-542-5942 |
| 16 | +;; 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652 |
| 17 | +;; Boston, MA 02110-1301, USA gnu@gnu.org |
| 18 | +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
| 19 | + |
| 20 | +(setenv "GNC_UNINSTALLED" "1") |
| 21 | +(debug-set! stack 50000) |
| 22 | +(load-from-path "c-interface") |
| 23 | +(use-modules (gnucash engine test test-extras)) |
| 24 | + |
| 25 | +(define (test-func a b) |
| 26 | + (list (/ a b) 6)) |
| 27 | + |
| 28 | +(define (run-test) |
| 29 | + (and (test test-call-with-error-handling) |
| 30 | + (test test-eval-string-with-error-handling) |
| 31 | + (test test-apply-with-error-handling))) |
| 32 | + |
| 33 | +(define (test-call-with-error-handling) |
| 34 | + (and (eq? #f (cadr (gnc:call-with-error-handling test-func (list 4 5)))) |
| 35 | + (eq? #f (cadr (gnc:call-with-error-handling "(test-func 4 5)" '()))) |
| 36 | + (eq? #f (car (gnc:call-with-error-handling test-func (list 4 0)))) |
| 37 | + (eq? #f (car (gnc:call-with-error-handling "(test-func 4 0)" '()))))) |
| 38 | + |
| 39 | +(define (test-eval-string-with-error-handling) |
| 40 | + (and (eq? #f (cadr (gnc:eval-string-with-error-handling "(test-func 4 5)"))) |
| 41 | + (eq? #f (car (gnc:eval-string-with-error-handling "(test-func 4 0)"))))) |
| 42 | + |
| 43 | +(define (test-apply-with-error-handling) |
| 44 | + (and (eq? #f (cadr (gnc:apply-with-error-handling test-func (list 4 5)))) |
| 45 | + (eq? #f (car (gnc:apply-with-error-handling test-func (list 4 0)))))) |
0 commit comments