Merge pull request #540 from wasamasa/read-error-for-unterminated-strings

Consider unterminated strings as read-error
This commit is contained in:
Alex Shinn 2019-05-23 14:33:51 +08:00 committed by GitHub
commit 6a35a95dfc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 1 deletions

View file

@ -24,7 +24,7 @@
(else (lp (cdr files) (append (read-sexps (car files) #t) res)))))))) (else (lp (cdr files) (append (read-sexps (car files) #t) res))))))))
(define (read-error? x) (define (read-error? x)
(and (error-object? x) (eq? 'read (exception-kind x)))) (and (error-object? x) (memq (exception-kind x) '(read read-incomplete)) #t))
(define (file-error? x) (define (file-error? x)
(and (error-object? x) (eq? 'file (exception-kind x)))) (and (error-object? x) (eq? 'file (exception-kind x))))

View file

@ -1778,6 +1778,8 @@
(read-error? (guard (exn (else exn)) (error "BOOM!")))) (read-error? (guard (exn (else exn)) (error "BOOM!"))))
(test #t (test #t
(read-error? (guard (exn (else exn)) (read (open-input-string ")"))))) (read-error? (guard (exn (else exn)) (read (open-input-string ")")))))
(test #t
(read-error? (guard (exn (else exn)) (read (open-input-string "\"")))))
(define something-went-wrong #f) (define something-went-wrong #f)
(define (test-exception-handler-1 v) (define (test-exception-handler-1 v)