diff options
| author | Ludovic Courtès <ludo@gnu.org> | 2022-08-10 16:37:34 +0200 |
|---|---|---|
| committer | Ludovic Courtès <ludo@gnu.org> | 2022-08-10 16:53:58 +0200 |
| commit | ebda12e1d2c64480bb7d5977e580d8b2eabeb503 (patch) | |
| tree | 24a8bc2b129d4865c9489891204d6dcb00f26a13 /tests/read-print.scm | |
| parent | 06ce4e3c06145423e66bb5694d800256e762057c (diff) | |
read-print: Report missing closing parens instead of looping.
Fixes <https://issues.guix.gnu.org/57093>.
Reported by Mohammed AMAR-BENSABER <renken@shione.net>.
Previously 'read-with-comments' would enter an infinite loop.
* guix/read-print.scm (read-with-comments)[missing-closing-paren-error]:
New procedure.
Call it when 'loop' as called from 'liip' returns EOF.
* tests/read-print.scm ("read-with-comments: missing closing paren"):
New test.
Diffstat (limited to 'tests/read-print.scm')
| -rw-r--r-- | tests/read-print.scm | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/read-print.scm b/tests/read-print.scm index b484e280227..4dabcc1e64c 100644 --- a/tests/read-print.scm +++ b/tests/read-print.scm | |||
| @@ -19,6 +19,8 @@ | |||
| 19 | (define-module (tests-style) | 19 | (define-module (tests-style) |
| 20 | #:use-module (guix read-print) | 20 | #:use-module (guix read-print) |
| 21 | #:use-module (guix gexp) ;for the reader extensions | 21 | #:use-module (guix gexp) ;for the reader extensions |
| 22 | #:use-module (srfi srfi-34) | ||
| 23 | #:use-module (srfi srfi-35) | ||
| 22 | #:use-module (srfi srfi-64) | 24 | #:use-module (srfi srfi-64) |
| 23 | #:use-module (ice-9 match)) | 25 | #:use-module (ice-9 match)) |
| 24 | 26 | ||
| @@ -46,6 +48,11 @@ expressions." | |||
| 46 | 48 | ||
| 47 | (test-begin "read-print") | 49 | (test-begin "read-print") |
| 48 | 50 | ||
| 51 | (test-assert "read-with-comments: missing closing paren" | ||
| 52 | (guard (c ((error? c) #t)) | ||
| 53 | (call-with-input-string "(what is going on?" | ||
| 54 | read-with-comments))) | ||
| 55 | |||
| 49 | (test-equal "read-with-comments: dot notation" | 56 | (test-equal "read-with-comments: dot notation" |
| 50 | (cons 'a 'b) | 57 | (cons 'a 'b) |
| 51 | (call-with-input-string "(a . b)" | 58 | (call-with-input-string "(a . b)" |
