copy-readtable.lsp 1.11 KB
Newer Older
pfdietz's avatar
pfdietz committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
;-*- Mode:     Lisp -*-
;;;; Author:   Paul Dietz
;;;; Created:  Fri Dec 31 07:15:35 2004
;;;; Contains: Tests of COPY-READTABLE

(in-package :cl-test)

(deftest copy-readtable.1
  (notnot-mv (typep (copy-readtable) 'readtable))
  t)

(deftest copy-readtable.2
  (notnot-mv (typep (copy-readtable *readtable*) 'readtable))
  t)

(deftest copy-readtable.3
  (notnot-mv (typep (copy-readtable *readtable* nil) 'readtable))
  t)

(deftest copy-readtable.4
  (let ((rt (copy-readtable *readtable*)))
    (eql rt *readtable*))
  nil)

(deftest copy-readtable.5
  (let ((rt (copy-readtable *readtable* nil)))
    (eql rt *readtable*))
  nil)

(deftest copy-readtable.6
  (let* ((rt (copy-readtable))
sds's avatar
sds committed
32
         (rt2 (copy-readtable *readtable* rt)))
pfdietz's avatar
pfdietz committed
33 34 35
    (notnot (eql rt rt2)))
  t)

pfdietz's avatar
pfdietz committed
36 37 38 39 40 41 42 43 44
;;; NIL as a readtable designator indicating the standard readtable
(deftest copy-readtable.7
  (let ((rt (copy-readtable nil)))
    (values
     (notnot rt)
     (notnot (readtablep rt))
     (not (eql rt *readtable*))))
  t t t)

pfdietz's avatar
pfdietz committed
45 46 47 48 49 50 51 52 53 54
;;; Error tests

(deftest copy-readtable.error.1
  (signals-error (copy-readtable *readtable* nil nil) program-error)
  t)