1
0
mirror of synced 2026-01-17 09:03:14 +00:00

124 lines
3.4 KiB
Plaintext

;; Function To Be Tested: DIR (Programmer's Assistant Command)
;;
;; Source: Xerox Common Lisp Implementation Notes (Lyric Beta Release)
;; Section 20.2 (The Evaluator), Page 28
;;
;; Section: The Evaluator
;;
;; Page: 28
;;
;; Created By: John Park
;;
;; Creation Date: Feb 10, 1987
;;
;; Last Update: Feb 26, 1987
;;
;; Filed As: {ERIS}<lispcore>test>exec>dir.u
;;
;;
;; Syntax: DIR &optional PATHNAME &rest KEYWORDS
;;
;; Function Description: Shows a directory listing for PATHNAME or the connected
;; directory. If provided, KEYWORDS indicate information to be displayed for each
;; file. Some keywords are: AUTHOR, AU, CREATIONDATE, DA, etc.
;;
;; Argument(s): Pathname or Connected Directory
;;
;; Returns: See function description
;;
;; Constraints/Limitations: Due to the nature of Programmer's Assistant commands,
;; testing them willbe accomplished by using the interlisp function bksysbuf
;; in do-test form. Comments are incorporated within each command file.
;; Each test setup is titled "COMMAND-TEST-SETUP", which executes the command
;; string. The do-test form within the command file will return T or "test "quote"
;; failed in file "unknown". " This test file requires TEDIT package.
;; The test result will be logged automatically in the following file:
;; {ERIS}<lispcore>test>exec>test.report
(DO-TEST 'DIR-TEST-SETUP
(PROGN
(SETQ TEST-RESULT "{ERIS}<LISPCORE>TEST>EXEC>TEST.REPORT")
(DEFUN R-FORMAT (STATUS)
(FORMAT *OUTPUT* "~%COMMAND:DIR ~%STATUS: ~A DATE: ~A TESTER: ~A~%" STATUS (IL:DATE) IL:USERNAME))
(SETQ MESS1 "Connecting to a new directory ({core}<test>)...")
(SETQ MESS2 "Displaying files in the connected-directory...")
(SETQ MESS3 "Displaying files with creationdate, size, and author")
(SETQ MESS4 "Now do-test will determine if files exist as indicated by DIR...")
(PROGN
(PRINC "creating three files for testing......")
(SLEEP 2)
(VALUES)
)
(SETQ TEST-WINDOW (IL:CREATEW '(100 100 300 200) "TEST WINDOW FOR DIR"))
(SETQ TEST-STREAM1
(IL:OPENTEXTSTREAM "THIS IS CONTENT OF WINDOW ONE" TEST-WINDOW))
(IL:TEDIT.PUT TEST-WINDOW '{CORE}<TEST>FILE1)
(IL:CLEARW TEST-WINDOW)
(SETQ TEST-STREAM2
(IL:OPENTEXTSTREAM "SECOND FILE" TEST-WINDOW))
(IL:TEDIT.PUT TEST-WINDOW '{CORE}<TEST>FILE2)
(IL:CLEARW TEST-WINDOW)
(SETQ TEST-STREAM3
(IL:OPENTEXTSTREAM "LAST!" TEST-WINDOW))
(IL:TEDIT.PUT TEST-WINDOW '{CORE}<TEST>FILE3)
(CLOSE TEST-STREAM1)
(CLOSE TEST-STREAM2)
(CLOSE TEST-STREAM3)
(IL:CLOSEW TEST-WINDOW)
(SETQ DIR-COMMAND-STRING
"(PROGN (PRINC MESS1)
(SLEEP 2)
(VALUES)
)
CONN {CORE}<TEST>
(PROGN (PRINC MESS2)
(SLEEP 2)
(VALUES)
)
DIR
(PROGN (PRINC MESS3)
(SLEEP 2)
(VALUES)
)
DIR {CORE}<TEST> CREATIONDATE SIZE AUTHOR
CONN
(PROGN (PRINC MESS4)
(SLEEP 2)
(VALUES)
)
(DO-TEST 'DIR-TEST-RESULT
(PROG2 (SETQ *OUTPUT* (OPEN TEST-RESULT :DIRECTION :OUTPUT
:IF-EXISTS :APPEND))
(IF (AND (PROBE-FILE '{CORE}<TEST>FILE1)
(PROBE-FILE '{CORE}<TEST>FILE2)
(PROBE-FILE '{CORE}<TEST>FILE3))
(PROGN (R-FORMAT 'SUCCESS) T)
(PROGN (R-FORMAT 'FAIL) NIL))
(CLOSE *OUTPUT*)
(IF (PROBE-FILE '{CORE}<TEST>FILE1)
(DELETE-FILE '{CORE}<TEST>FILE1))
(IF (PROBE-FILE '{CORE}<TEST>FILE2)
(DELETE-FILE '{CORE}<TEST>FILE2))
(IF (PROBE-FILE '{CORE}<TEST>FILE3)
(DELETE-FILE '{CORE}<TEST>FILE3))
)
)
")
(IL:BKSYSBUF DIR-COMMAND-STRING)
)
)
STOP