Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
ansi-test
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Mark Evenson
ansi-test
Commits
f95ae1a6
Commit
f95ae1a6
authored
9 years ago
by
Daniel Kochmański
Browse files
Options
Downloads
Patches
Plain Diff
tests: readtable-case: test all cases of conversion
parent
d2d07659
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
reader/readtable-case.lsp
+31
-0
31 additions, 0 deletions
reader/readtable-case.lsp
with
31 additions
and
0 deletions
reader/readtable-case.lsp
+
31
−
0
View file @
f95ae1a6
...
@@ -5,6 +5,8 @@
...
@@ -5,6 +5,8 @@
(in-package :cl-test)
(in-package :cl-test)
;;; readtable-case setting
(deftest readtable-case.1
(deftest readtable-case.1
(with-standard-io-syntax
(with-standard-io-syntax
(readtable-case *readtable*))
(readtable-case *readtable*))
...
@@ -53,6 +55,35 @@
...
@@ -53,6 +55,35 @@
(list rtc rt2)))))
(list rtc rt2)))))
nil)
nil)
;; readtable-case reading
(symbol-macrolet ((lookup-table
'(:SYMBOL ("zebra" "Zebra" "ZEBRA" "zebr\\a" "zebr\\A" "ZEBR\\a" "ZEBR\\A" "Zebr\\a" "Zebr\\A")
:UPCASE (|ZEBRA| |ZEBRA| |ZEBRA| |ZEBRa| |ZEBRA| |ZEBRa| |ZEBRA| |ZEBRa| |ZEBRA|)
: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|))))
(macrolet
((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
(deftest readtable.case.invert-char
(let ((*readtable* (copy-readtable)))
(setf (readtable-case *readtable*) :invert)
(read-from-string "#\\a"))
#\a 3)
;;; Error cases
;;; Error cases
(deftest readtable-case.error.1
(deftest readtable-case.error.1
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment