write-to-string.lsp 958 Bytes
Newer Older
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 32 33 34 35 36 37 38 39 40 41 42 43
;-*- Mode:     Lisp -*-
;;;; Author:   Paul Dietz
;;;; Created:  Sun Jul 25 12:53:11 2004
;;;; Contains: Tests of WRITE-TO-STRING

(in-package :cl-test)

(compile-and-load "printer-aux.lsp")

;;; This function is extensively used elsewhere

(deftest write-to-string.1
  (random-write-to-string-test 1000)
  nil)

(deftest write-to-string.2
  (with-standard-io-syntax
   (write-to-string 2 :allow-other-keys nil))
  "2")

(deftest write-to-string.3
  (with-standard-io-syntax
   (write-to-string 3 :allow-other-keys t '#.(gensym) 0))
  "3")

(deftest write-to-string.4
  (with-standard-io-syntax
   (write-to-string 4 :base 10 :base 2))
  "4")

;;; Error tests

(deftest write-to-string.error.1
  (signals-error (write-to-string) program-error)
  t)

(deftest write-to-string.error.2
  (signals-error (write-to-string nil '#.(gensym) nil) program-error)
  t)

(deftest write-to-string.error.3
  (signals-error (write-to-string nil :radix) program-error)
  t)