Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
ansi-test
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Karsten Poeck
ansi-test
Commits
8eafcc98
Commit
8eafcc98
authored
Jul 01, 2004
by
pfdietz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added pprint-tabular tests.
parent
62efbac8
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
109 additions
and
1 deletion
+109
-1
ansi-tests/load-printer.lsp
ansi-tests/load-printer.lsp
+2
-1
ansi-tests/pprint-tabular.lsp
ansi-tests/pprint-tabular.lsp
+107
-0
No files found.
ansi-tests/load-printer.lsp
View file @
8eafcc98
...
...
@@ -27,4 +27,5 @@
(load "printer-control-vars.lsp")
(load "pprint-dispatch.lsp")
(load "pprint-fill.lsp")
(load "pprint-linear.lsp")
\ No newline at end of file
(load "pprint-linear.lsp")
(load "pprint-tabular.lsp")
ansi-tests/pprint-tabular.lsp
0 → 100644
View file @
8eafcc98
;-*- Mode: Lisp -*-
;;;; Author: Paul Dietz
;;;; Created: Sun Jun 27 06:29:39 2004
;;;; Contains: Tests of PPRINT-TABULAR
(in-package :cl-test)
;;; When printing a non-list, the result is the same as calling WRITE."
(deftest pprint-tabular.1
(my-with-standard-io-syntax
(let ((*print-pretty* t)
(*print-readably* nil))
(loop for obj in *mini-universe*
nconc
(and (not (listp obj))
(let ((s1 (write-to-string obj))
(s2 (with-output-to-string (s) (pprint-tabular s obj))))
(unless (equal s1 s2)
(list (list obj s1 s2))))))))
nil)
(deftest pprint-tabular.2
(my-with-standard-io-syntax
(let ((*print-pretty* nil)
(*print-readably* nil))
(loop for obj in *mini-universe*
nconc
(and (not (listp obj))
(let ((s1 (write-to-string obj))
(s2 (with-output-to-string (s) (pprint-tabular s obj))))
(unless (equal s1 s2)
(list (list obj s1 s2))))))))
nil)
(defmacro def-pprint-tabular-test (name args expected-value &key (margin 100) (circle nil) (pre nil))
`(deftest ,name
(my-with-standard-io-syntax
(let ((*print-pretty* t)
(*print-readably* nil)
(*print-right-margin* ,margin)
(*package* (find-package :cl-test))
(*print-circle* ,circle))
(with-output-to-string
(s)
,@(when pre (list pre))
(pprint-tabular s ,@args))))
,expected-value))
(def-pprint-tabular-test pprint-tabular.3 ('(|M|)) "(M)")
(def-pprint-tabular-test pprint-tabular.4 ('(|M|) t) "(M)")
(def-pprint-tabular-test pprint-tabular.5 ('(|M|) nil) "M")
(def-pprint-tabular-test pprint-tabular.6 ('(|M| |M|)) "(M M)")
(def-pprint-tabular-test pprint-tabular.7 ('(|M| |M|) t nil 1) "(M M)")
(def-pprint-tabular-test pprint-tabular.8 ('(|M| |M|) t t 3) "(M M)")
(def-pprint-tabular-test pprint-tabular.9 ('(|M| |M|) t nil 4) "(M M)")
(def-pprint-tabular-test pprint-tabular.10 ('(|MM| |MM|) t nil 4) "(MM MM)")
(def-pprint-tabular-test pprint-tabular.11 ('(|MM| |MM|) t nil 5) "(MM MM)")
(def-pprint-tabular-test pprint-tabular.12 ('(|M| |MM|) t nil 5) "(M MM)")
(def-pprint-tabular-test pprint-tabular.13 ((let ((x (list '|A|))) (list x x)) t nil 1)
"(#1=(A) #1#)" :circle t)
(def-pprint-tabular-test pprint-tabular.14 ('(|M| |M|) t t 4) "(M M)")
(def-pprint-tabular-test pprint-tabular.15 ('(1 2 3 4) t t 1) "(1 2 3 4)")
(def-pprint-tabular-test pprint-tabular.16 ('(10 20 30 40) t t 1) "(10 20 30 40)")
(def-pprint-tabular-test pprint-tabular.17 ('(10 200 3000 40000) t t 1) "(10 200 3000 40000)")
(def-pprint-tabular-test pprint-tabular.18 ('(10 20 30 40) t t 2) "(10 20 30 40)")
(def-pprint-tabular-test pprint-tabular.19 ('(10 200 3000 40000) t t 2) "(10 200 3000 40000)")
(def-pprint-tabular-test pprint-tabular.20 ('(1 2 3) t nil 1)
" (1 2 3)"
:pre (write " " :stream s :escape nil))
(def-pprint-tabular-test pprint-tabular.21 ('(1 2 3) t nil 1)
" (1
2
3)"
:pre (write " " :stream s :escape nil) :margin 9)
(def-pprint-tabular-test pprint-tabular.22 ('(1 2 3) t nil 1)
" (1 2
3)"
:pre (write " " :stream s :escape nil) :margin 10)
;;; Test that pprint-tabular returns NIL
(deftest pprint-tabular.return-values.1
(my-with-standard-io-syntax
(let ((*print-pretty* nil)
(*package* (find-package :cl-test)))
(with-open-stream (s (make-broadcast-stream))
(pprint-tabular s '(a b)))))
nil)
(deftest pprint-tabular.return-values.2
(my-with-standard-io-syntax
(let ((*print-pretty* nil)
(*package* (find-package :cl-test)))
(with-open-stream (s (make-broadcast-stream))
(pprint-tabular s 10 nil nil 100))))
nil)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment