From ebda12e1d2c64480bb7d5977e580d8b2eabeb503 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Wed, 10 Aug 2022 16:37:34 +0200 Subject: read-print: Report missing closing parens instead of looping. Fixes . Reported by Mohammed AMAR-BENSABER . 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. --- tests/read-print.scm | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'tests/read-print.scm') diff --git a/tests/read-print.scm b/tests/read-print.scm index b484e28022..4dabcc1e64 100644 --- a/tests/read-print.scm +++ b/tests/read-print.scm @@ -19,6 +19,8 @@ (define-module (tests-style) #:use-module (guix read-print) #:use-module (guix gexp) ;for the reader extensions + #:use-module (srfi srfi-34) + #:use-module (srfi srfi-35) #:use-module (srfi srfi-64) #:use-module (ice-9 match)) @@ -46,6 +48,11 @@ (define-syntax-rule (test-pretty-print/sequence str args ...) (test-begin "read-print") +(test-assert "read-with-comments: missing closing paren" + (guard (c ((error? c) #t)) + (call-with-input-string "(what is going on?" + read-with-comments))) + (test-equal "read-with-comments: dot notation" (cons 'a 'b) (call-with-input-string "(a . b)" -- cgit v1.2.3