X-Git-Url: http://git.kpe.io/?p=hyperobject.git;a=blobdiff_plain;f=tests.lisp;h=9b68d9891fcda355cd1ed4b07ddbf6b6c4ba51ae;hp=135499690d3d8bc91c5687c89e38f7fffad89b00;hb=0817a8721cbefca2205dcde535ff6b164033abef;hpb=7b3ca1025e0b572b6511c044e948aeab2147af45 diff --git a/tests.lisp b/tests.lisp index 1354996..9b68d98 100644 --- a/tests.lisp +++ b/tests.lisp @@ -7,28 +7,15 @@ ;;;; Programmer: Kevin M. Rosenberg ;;;; Date Started: Apr 2003 ;;;; -;;;; $Id: tests.lisp,v 1.2 2003/04/28 19:06:13 kevin Exp $ -;;;; -;;;; This file is Copyright (c) 2000-2002 by Kevin M. Rosenberg +;;;; $Id$ ;;;; +;;;; This file is Copyright (c) 2000-2003 by Kevin M. Rosenberg ;;;; ************************************************************************* (defpackage #:hyperobject-tests - (:use #:hyperobject #:cl #:rtest)) + (:use #:hyperobject #:cl #:rtest #:kmrcl)) (in-package #:hyperobject-tests) -(defun format-date (ut) - (when (typep ut 'integer) - (multiple-value-bind (sec min hr day mon year dow daylight-p zone) - (decode-universal-time ut) - (declare (ignore daylight-p zone)) - (format nil "~[Mon~;Tue~;Wed~;Thu~;Fri~;Sat~;Sun~], ~d ~[Jan~;Feb~;Mar~;Apr~;May~;Jun~;Jul~;Aug~;Sep~;Oct~;Nov~;Dec~] ~d ~2,'0d:~2,'0d:~2,'0d" - dow - day - (1- mon) - year - hr min sec)))) - (defclass person (hyperobject) ((first-name :initarg :first-name :accessor first-name :value-type (varchar 20) @@ -38,11 +25,12 @@ :value-type (varchar 30) :value-constraint stringp :hyperlink find-person-by-last-name + :hyperlink-parameters (("narrow" . "yes")) :null-allowed nil) (full-name :value-type string :stored nil) (dob :initarg :dob :accessor dob :value-type integer - :print-formatter format-date + :print-formatter date-string :value-constraint integerp :input-filter convert-to-date) (resume :initarg :resume :accessor resume @@ -71,7 +59,7 @@ :subobject t)) (:metaclass hyperobject-class) (:default-initargs :title nil :street nil) - (:user-name "Address") + (:user-name "Address" "Addresses") (:default-print-slots title street) (:description "An address")) @@ -81,7 +69,8 @@ :value-constraint stringp) (phone-number :initarg :phone-number :accessor phone-number :value-type (varchar 16) - :value-constraint stringp)) + :value-constraint stringp + :hyperlink search-phone-number)) (:metaclass hyperobject-class) (:user-name "Phone Number") (:default-initargs :title nil :phone-number nil) @@ -108,11 +97,6 @@ :addresses (list home office) :resume "Style & Grace")) -;(format t "~&Text Format~%") -;(view mary :subobjects t) - -;(format t "~&XML Format with field labels and hyperlinks~%") -;(view mary :subobjects t :category :xml-link-labels) (defun view-to-string (obj &rest args) (with-output-to-string (strm) @@ -120,13 +104,13 @@ (rem-all-tests) -(deftest p1 (view-to-string mary) " Person: +(deftest p1 (view-to-string mary) "Person: Mary Jackson Thu, 4 May 2000 03:02:01 Style & Grace ") -(deftest p2 (view-to-string mary :subobjects t) " Person: +(deftest p2 (view-to-string mary :subobjects t) "Person: Mary Jackson Thu, 4 May 2000 03:02:01 Style & Grace - Addresss: + Addresses: Home 321 Shady Lane Phone Numbers: Voice 367-9812 @@ -137,3 +121,9 @@ Staff line 123-0002 Fax 123-0005 ") + +(deftest p3 (view-to-string mary :vid :compact-text-labels) + "Person: + first-name Mary last-name Jackson dob Thu, 4 May 2000 03:02:01 resume Style & Grace +") +