diff options
-rw-r--r-- | test/simple.tl (renamed from test/simple) | 40 |
1 files changed, 26 insertions, 14 deletions
diff --git a/test/simple b/test/simple.tl index c952fa0..1100f25 100644 --- a/test/simple +++ b/test/simple.tl @@ -1,20 +1,32 @@ -;;; -*- Mode: LISP; Syntax: COMMON-LISP; Package: CL-WHO-TEST; Base: 10 -*- -;;; $Header: /usr/local/cvsrep/cl-who/test/simple,v 1.4 2009/01/26 11:10:52 edi Exp $ +;;; some simple tests for TL-WHO. -;;; some simple tests for CL-WHO - entered manually and to be read -;;; in the CL-WHO-TEST package; all forms are expected to return a -;;; true value on success when EVALuated +(load "../tl-who") + +(defpackage "tl-who-test" + (:fallback "tl-who" "usr")) + +(in-package "tl-who-test") + +(defmacro test (test-expr expected-expr) + (with-gensyms (te ee) + ^(let ((,te ,test-expr) + (,ee ,expected-expr)) + (unless (equal ,te ,ee) + (error "~s\nproduced:\n~s\nrather than:\n~s" + ',test-expr ,te ,ee))))) ;;; 1 -(string= (with-output-to-string (out) - (with-html-output (out) - (loop for (link . title) in '(("http://zappa.com/" . "Frank Zappa") - ("http://marcusmiller.com/" . "Marcus Miller") - ("http://www.milesdavis.com/" . "Miles Davis")) - do (htm (:a :href link - (:b (str title))) - :br)))) - "<a href='http://zappa.com/'><b>Frank Zappa</b></a><br /><a href='http://marcusmiller.com/'><b>Marcus Miller</b></a><br /><a href='http://www.milesdavis.com/'><b>Miles Davis</b></a><br />") +(test (with-out-string-stream (out) + (with-html-output (out) + (keep-matches ((@link . @title) '(("http://zappa.com/" . "Frank Zappa") + ("http://marcusmiller.com/" . "Marcus Miller") + ("http://www.milesdavis.com/" . "Miles Davis"))) + (htm (:a :href link + (:b (str title))) + :br)))) + "<a href='http://zappa.com/'><b>Frank Zappa</b></a><br /><a href='http://marcusmiller.com/'><b>Marcus Miller</b></a><br /><a href='http://www.milesdavis.com/'><b>Miles Davis</b></a><br />") + +(exit) ;;; 2 (string= (with-output-to-string (out) |