| 1 |
;;; Test for call-with-error-handling. -*- scheme -*- |
| 2 |
;;; Copyright (C) 2023 |
| 3 |
;;; Free Software Foundation, Inc. |
| 4 |
;;; |
| 5 |
;;; This library is free software: you can redistribute it and/or modify |
| 6 |
;;; it under the terms of the GNU Lesser General Public License as |
| 7 |
;;; published by the Free Software Foundation, either version 3 of the |
| 8 |
;;; License, or (at your option) any later version. |
| 9 |
;;; |
| 10 |
;;; This library is distributed in the hope that it will be useful, but |
| 11 |
;;; WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 |
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 13 |
;;; Lesser General Public License for more details. |
| 14 |
;;; |
| 15 |
;;; You should have received a copy of the GNU Lesser General Public |
| 16 |
;;; License along with this program. If not, see |
| 17 |
;;; <http://www.gnu.org/licenses/>. |
| 18 |
|
| 19 |
(define-module (test-suite test-error-handling) |
| 20 |
#:use-module (test-suite lib) |
| 21 |
#:use-module (system base compile) |
| 22 |
#:use-module (system repl error-handling)) |
| 23 |
|
| 24 |
(with-test-prefix "call-with-values" |
| 25 |
(pass-if "backtrace with builtin" |
| 26 |
(let* ((thunk (compile '(lambda () |
| 27 |
(symbol? |
| 28 |
(call-with-values (lambda () (error 'oh-no)) |
| 29 |
list))))) |
| 30 |
(str (with-output-to-string |
| 31 |
(lambda () |
| 32 |
(call-with-error-handling thunk #:on-error 'backtrace)))) |
| 33 |
(lines (string-split str #\newline))) |
| 34 |
;; For https://debbugs.gnu.org/63279, we just want to ensure that |
| 35 |
;; the backtrace completes. The check is just that the backtrace |
| 36 |
;; has at least a couple frames. |
| 37 |
(>= (length lines) 4)))) |