Commit b71c6b7a authored by pfdietz's avatar pfdietz
Browse files

Begin adding tests of section 2 (standard syntax)

parent 56c5d882
......@@ -15,3 +15,4 @@
(load "readtable-case.lsp")
(load "readtablep.lsp")
(load "syntax.lsp")
;-*- Mode: Lisp -*-
;;;; Author: Paul Dietz
;;;; Created: Sun Jan 2 08:12:51 2005
;;;; Contains: Tests of standard syntax
(in-package :cl-test)
(defmacro def-syntax-test (name form &rest expected-results)
`(deftest ,name
(with-standard-io-syntax ,form)
,@expected-results))
;;; Test that
(def-syntax-test syntax.whitespace.1
;; Check that various standard or semistandard characters are whitespace[2]
(let ((names '("Tab" "Newline" "Linefeed" "Space" "Return" "Page")))
(loop for name in names
for c = (name-char name)
nconc
(when c
(let* ((s (concatenate 'string (string c) "123"))
(val (read-from-string s)))
(unless (eql val 123)
(list (list name c s val)))))))
nil)
(def-syntax-test syntax.constituent.1
;; Tests of various characters that they are constituent characters,
;; and parse to symbols
(let ((chars (concatenate
'string
"!$%&*<=>?@[]^_-{}+/"
"abcdefghijklmnopqrstuvwxyz"
"ABCDEFGHIJKLMNOPQRSTUVWXYZ")))
(loop for c across chars
for s = (string c)
for sym = (read-from-string s)
unless (string= (symbol-name sym) (string-upcase s))
collect (list c sym)))
nil)
;;; Backspace is an invalid constituent character
(def-syntax-test syntax.backspace.invalid
(let ((c (name-char "Backspace")))
(if (not c) t
(eval `(signals-error (read-from-string (string ,c)) reader-error))))
t)
;;; Rubout is an invalid constituent character
(def-syntax-test syntax.rubout.invalid
(let ((c (name-char "Rubout")))
(if (not c) t
(eval `(signals-error (read-from-string (string ,c)) reader-error))))
t)
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