[clhp-cvs] CVS update: clhp/tests/test-suite.lisp clhp/tests/cgi-test.lisp
Anthony Ventimiglia
aventimiglia at common-lisp.net
Thu Oct 16 04:00:42 UTC 2003
Update of /project/clhp/cvsroot/clhp/tests
In directory common-lisp.net:/tmp/cvs-serv15576/tests
Modified Files:
test-suite.lisp cgi-test.lisp
Log Message:
* tests/test-suite.lisp: Exporting OUTPUT-FUNCTION-TEST-DATA-OUTPUT
* tests/cgi-test.lisp (*CGI-TESTS*): Added tests for LIST-TO-A-LIST
Date: Thu Oct 16 00:00:42 2003
Author: aventimiglia
Index: clhp/tests/test-suite.lisp
diff -u clhp/tests/test-suite.lisp:1.1 clhp/tests/test-suite.lisp:1.2
--- clhp/tests/test-suite.lisp:1.1 Wed Oct 15 10:05:56 2003
+++ clhp/tests/test-suite.lisp Thu Oct 16 00:00:42 2003
@@ -27,7 +27,8 @@
(:nicknames #:test-suite)
(:use :cl)
(:export #:run-tests #:function-test-data
- #:output-function-test-data #:side-effect-function-test-data ))
+ #:output-function-test-data #:side-effect-function-test-data
+ #:output-function-test-data-output ))
(in-package :test-suite)
;; These macros Used for run-test methods
@@ -87,6 +88,7 @@
must be tested as well."))
(defclass side-effect-function-test-data (function-test-data)
+
((var-list :initform NIL
:type list
:reader side-effect-function-test-data-var-list
@@ -148,14 +150,14 @@
data))
(vars (mapcar #'(lambda (c) (car c)) test-var-list))
(var-list (mapcar
- #'(lambda (|v|) (list |v| (eval |v|))) vars)))
+ #'(lambda (v) (list v (eval v))) vars)))
(format stream "~S --> ~S ~S : "
test-form result var-list)
- (let ((test-result (output-function-test-data-output data)))
+ (let ((test-result (function-test-data-result-form data)))
(test-return (and (equal result test-result)
(equal test-var-list var-list))
"~S and ~S expected" test-result test-var-list))))
- (call-if-function (test-data-post-function data))))
+ (call-if-function (test-data-post-function data))))
;; Example
;(defvar list-test (make-instance 'function-test-data
Index: clhp/tests/cgi-test.lisp
diff -u clhp/tests/cgi-test.lisp:1.8 clhp/tests/cgi-test.lisp:1.9
--- clhp/tests/cgi-test.lisp:1.8 Wed Oct 15 10:05:56 2003
+++ clhp/tests/cgi-test.lisp Thu Oct 16 00:00:42 2003
@@ -41,7 +41,7 @@
;; INIT
;;
;; And
-;; POST-DATA QUERY-TO-A-LIST HANDLE-GENERAL-ERROR
+;; POST-DATA HANDLE-GENERAL-ERROR
;; Use the following to run-tests
;; (mapcar #'run-test *cgi-tests*)
@@ -101,6 +101,32 @@
:symbol 'cgi::ca-list-to-a-list
:test-args '('((a . 1)(b . 2)(c . 3)))
:result-form '((a 1)(b 2)(c 3)))
+ (make-instance 'function-test-data
+ :symbol 'cgi::list-to-a-list
+ :test-args '('(1 2 3 4 5 6 7 8))
+ :result-form '((1 2)(3 4)(5 6)(7 8)))
+ (make-instance 'function-test-data
+ :symbol 'cgi::list-to-a-list
+ :test-args '('(1 2 3 4 5 6 7 8 9))
+ ;; This should be (values ((1 2) .. ) 9) the testing
+ ;; system hgas to be refined
+ :result-form '((1 2)(3 4)(5 6)(7 8)))
+ (make-instance 'function-test-data
+ :symbol 'cgi::query-to-a-list
+ :test-args '((cgi::explode-string
+ "Hello=there&no=yes&red=blue"))
+ :result-form '(("Hello" "there") ("no" "yes")
+ ("red" "blue")))
+; (make-instance 'side-effect-function-test-data
+; :symbol 'cgi:init
+; :pre-function #'(lambda ()
+; (setq ext:*environment-list*
+; '((:request_method . "get")
+; (:query_string . "hi=4&a=5"))))
+; :post-function #'(lambda ()
+; (setq ext:*environment-list* nil))
+; :result-form '(values)
+; :var-list '((cgi:*server-env* t)))
(make-instance 'output-function-test-data
:symbol 'cgi:header
:output (format nil
@@ -121,19 +147,9 @@
(fmakunbound 'cgi:header)
(load "library:cgi"))
:symbol 'cgi:header
- :output "")))
+ :output "")
+ ))
-; (make-instance 'side-effect-function-test-data
-; :symbol 'cgi:init
-; :pre-function #'(lambda ()
-; (setq ext:*environment-list*
-; '((:request_method . "post")
-; (:query_string . "hi=4&a=5"))))
-; :post-function #'(lambda ()
-; (setq ext:*environment-list* "nil"))
-; :result-form '(values)
-; :var-list '((cgi:*server-env* t)))))
-;
(eval-when (load)
(unix:unix-exit (cadr (multiple-value-list (run-tests *cgi-tests*)))))
More information about the Clhp-cvs
mailing list