aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2023-05-28 13:28:19 -0700
committerKaz Kylheku <kaz@kylheku.com>2023-05-28 13:28:19 -0700
commit8b08528f6a597a298ca1d6a20f23a8823b88db59 (patch)
treeee87de101a2a1101c9840490c1aff57cc14bbb1a
parente7feece6d9655b940af821fa5a4592cc49a986a1 (diff)
downloadtl-who-8b08528f6a597a298ca1d6a20f23a8823b88db59.tar.gz
tl-who-8b08528f6a597a298ca1d6a20f23a8823b88db59.tar.bz2
tl-who-8b08528f6a597a298ca1d6a20f23a8823b88db59.zip
Starting TL-WHO tests.
* test/simple: renamed to simple.tl. Just a self-contained file we can run. The first test has been rewritten to TL. After that we (exit). The first test is failing; it is not rendering any attributes.
-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)