Commit f95ae1a6 authored by Daniel Kochmański's avatar Daniel Kochmański
Browse files

tests: readtable-case: test all cases of conversion

parent d2d07659
......@@ -5,6 +5,8 @@
(in-package :cl-test)
;;; readtable-case setting
(deftest readtable-case.1
(readtable-case *readtable*))
......@@ -53,6 +55,35 @@
(list rtc rt2)))))
;; readtable-case reading
(symbol-macrolet ((lookup-table
'(:SYMBOL ("zebra" "Zebra" "ZEBRA" "zebr\\a" "zebr\\A" "ZEBR\\a" "ZEBR\\A" "Zebr\\a" "Zebr\\A")
:DOWNCASE (|zebra| |zebra| |zebra| |zebra| |zebrA| |zebra| |zebrA| |zebra| |zebrA|)
:PRESERVE (|zebra| |Zebra| |ZEBRA| |zebra| |zebrA| |ZEBRa| |ZEBRA| |Zebra| |ZebrA|)
:INVERT (|ZEBRA| |Zebra| |zebra| |ZEBRa| |ZEBRA| |zebra| |zebrA| |Zebra| |ZebrA|))))
((def-readtable-case-test (reader-case)
`(deftest ,(make-symbol (concatenate 'string "READTABLE-CASE.CASE-"
(symbol-name reader-case)))
(let ((*readtable* (copy-readtable)))
(setf (readtable-case *readtable*) ,reader-case)
(mapcar #'(lambda (x)
(read-from-string x))
',(getf lookup-table :symbol)))
,(getf lookup-table reader-case))))
(def-readtable-case-test :upcase)
(def-readtable-case-test :downcase)
(def-readtable-case-test :preserve)
(def-readtable-case-test :invert)))
;; when readtable was :invert quoted characters may get inverted too
(let ((*readtable* (copy-readtable)))
(setf (readtable-case *readtable*) :invert)
(read-from-string "#\\a"))
#\a 3)
;;; Error cases
(deftest readtable-case.error.1
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment