more-tests-and-corner-cases #72
@@ -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 "")
|
||||||
|
|||||||
@@ -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")
|
||||||
|
|||||||
Reference in New Issue
Block a user