more-tests-and-corner-cases #72

Merged
pkulev merged 74 commits from more-tests-and-corner-cases into main 2026-10-27 22:21:02 +01:00
2 changed files with 13 additions and 0 deletions
Showing only changes of commit 192ed2ba64 - Show all commits

View File

@@ -445,10 +445,15 @@
("delete" . #\delete) ("escape" . #\escape) ("alarm" . #\alarm) ("delete" . #\delete) ("escape" . #\escape) ("alarm" . #\alarm)
("backspace" . #\backspace))) ("backspace" . #\backspace)))
;;; A char is C's, one byte: #\λ was a multi-character constant, whose
;;; value is the C compiler's to choose
(define (read-char-lit port) (define (read-char-lit port)
(let ((first (get-ch port))) (let ((first (get-ch port)))
(when (eof-object? first) (when (eof-object? first)
(error "Unexpected end of input in character literal")) (error "Unexpected end of input in character literal"))
(when (> (char->integer first) 127)
(error "a char is one byte, and this is not: write its code point, or a string"
first))
(if (char-alphabetic? first) (if (char-alphabetic? first)
(let ((rest (read-atom-string port))) (let ((rest (read-atom-string port)))
(if (string=? rest "") (if (string=? rest "")

View File

@@ -115,6 +115,14 @@
(test "a surrogate is no character" (test "a surrogate is no character"
"no character has this code point" (read-error "\"\\uD800\"")) "no character has this code point" (read-error "\"\\uD800\""))
;; A char is C's, one byte, and #\λ came out a multi-character
;; constant whose value is the compiler's to choose
(test "a char is one byte"
"a char is one byte, and this is not: write its code point, or a string"
(read-error "#\\λ"))
(test "Latin-1 is no exception" #t (string? (read-error "#\\é")))
(reader-test '(#\a #\~ #\space) "#\\a #\\~ #\\space")
;; `;' comments are preserved as (comment "...") forms ;; `;' comments are preserved as (comment "...") forms
(reader-test '((comment " hi")) "; hi") (reader-test '((comment " hi")) "; hi")
(reader-test '((comment ";; Prototypes")) ";;; Prototypes") (reader-test '((comment ";; Prototypes")) ";;; Prototypes")