pprint.lsp 906 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
;-*- Mode:     Lisp -*-
;;;; Author:   Paul Dietz
;;;; Created:  Sun Jul 25 11:42:48 2004
;;;; Contains: Tests of PPRINT

(in-package :cl-test)

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

;;; This function is mostly tested elsewhere

(deftest pprint.1
  (random-pprint-test 1000)
  nil)

(deftest pprint.2
  (with-standard-io-syntax
   (with-output-to-string
     (os)
     (with-input-from-string
      (is "")
      (with-open-stream (*terminal-io* (make-two-way-stream is os))
sds's avatar
sds committed
23
                        (pprint 2 t)))))
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
  "
2")

(deftest pprint.3
  (with-standard-io-syntax
   (with-output-to-string
     (*standard-output*)
     (pprint 3 nil)))
  "
3")

;;; Error tests

(deftest pprint.error.1
  (signals-error
   (with-output-to-string (*standard-output*) (pprint))
   program-error)
  t)

(deftest pprint.error.2
  (signals-error
   (with-output-to-string (s) (pprint nil s nil))
   program-error)
  t)