From e17be519fc53950b680cf553bf992ff5b5447053 Mon Sep 17 00:00:00 2001 From: Krzysztof Drewniak Date: Wed, 6 Aug 2014 14:28:02 -0500 Subject: Make the reader normalize unescaped symbols to NFKC - The printer prints non-NFKC symbols escaped - The reader normalizes any unescaped (parts of) symbols to NFKC - SB-EXT:READTABLE-NORMALIZATION controls whether the reader performs normalization - The reader conses, so the non-consing reader tests are removed. --- tests/reader.impure.lisp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'tests/reader.impure.lisp') diff --git a/tests/reader.impure.lisp b/tests/reader.impure.lisp index 2a8312255..9c8ff832a 100644 --- a/tests/reader.impure.lisp +++ b/tests/reader.impure.lisp @@ -16,6 +16,29 @@ (load "assertoid.lisp") (use-package "ASSERTOID") +;;; Test that symbols are properly normalized in SB-UNICODE builds +(with-test (:name (:normalizing-reader) + :skipped-on '(not :sb-unicode)) + (labels ((str (&rest chars) + (coerce chars 'string)) + (symbol (&rest chars) + (read-from-string (apply #'str chars)))) + (assert (eq :a :a)) + (assert (eq :a :A)) + (assert (eq (symbol #\UF984) (symbol #\U6FFE))) + (make-package "BAFFLE") + (intern "C" "BAFFLE") + (assert (eq (symbol #\b #\a #\f #\f #\l #\e #\: #\: #\c) + (symbol #\b #\a #\UFB04 #\e #\: #\: #\c))) + (assert (not (eq (symbol #\| #\f #\f #\l #\|) (symbol #\| #\UFB04 #\|)))) + (assert (not (eq (symbol #\\ #\U32C0) (symbol #\1 #\U6708)))) + (assert (eq (symbol #\U32C0) (symbol #\1 #\U6708))) + (let ((*readtable* (copy-readtable))) + (setf (sb-ext:readtable-normalization *readtable*) nil) + (assert (not (eq (symbol #\b #\a #\f #\f #\l #\e) + (symbol #\b #\a #\UFB04 #\e)))) + (assert (not (eq (symbol #\U32C0) (symbol #\1 #\U6708))))))) + ;;; Bug 30, involving mistakes in binding the read table, made this ;;; code fail. (defun read-vector (stream char) -- cgit v1.2.3-70-g09d2