summaryrefslogtreecommitdiff
path: root/tests/reader.impure.lisp
diff options
context:
space:
mode:
authorKrzysztof Drewniak <krzysdrewniak@gmail.com>2014-08-06 14:28:02 -0500
committerKrzysztof Drewniak <krzysdrewniak@gmail.com>2014-10-01 22:35:52 -0500
commite17be519fc53950b680cf553bf992ff5b5447053 (patch)
treec74d3f98bf47c6f102097d61222cba5e13c61fa8 /tests/reader.impure.lisp
parent4accc9a01e211de5bdac1950777105e75ad0fe97 (diff)
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.
Diffstat (limited to 'tests/reader.impure.lisp')
-rw-r--r--tests/reader.impure.lisp23
1 files changed, 23 insertions, 0 deletions
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)