1
0
mirror of synced 2026-01-21 10:32:13 +00:00

112 lines
3.2 KiB
Plaintext

;; Function To Be Tested: NDIR (Programmer's Assistant Command)
;;
;;
;; Source: Xerox Common Lisp Implementation Notes (Lyric Beta Release)
;; Section 20.2 (The Evaluator), Page 28
;;
;; Section: The Evaluator
;; Created By: John Park
;;
;; Creation Date: Feb 10, 1987
;;
;; Last Update: Feb 27, 1987
;;
;; Filed As: {ERIS}<lispcore>integration>exec>ndir.u
;;
;;
;; Syntax: NDIR &optional PATHNAME &rest KEYWORDS
;;
;; Function Description: Shows a directory listing for PATHNAME or the connected
;; directory in abbreviated format. 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.
;; The do-test test setup is titled "NDIR-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 'NDIR-TEST-SETUP
(PROGN
(SETQ TEST-RESULT "{ERIS}<LISPCORE>TEST>EXEC>TEST.REPORT")
(DEFUN R-FORMAT (STATUS)
(FORMAT *OUTPUT* "~%COMMAND: NDIR ~%STATUS: ~A DATE: ~A TESTER: ~A~%" STATUS (IL:DATE) IL:USERNAME))
(SETQ MESS1 "Creating 6 new files in ({core}<NDIR>)...")
(SETQ MESS2 "Displaying files in the connected-directory...")
(SETQ MESS3 "Displaying files with creationdate and size")
(SETQ MESS4 "Now do-test will determine if files exist as indicated by NDIR...")
(DEFUN MESSAGE (MESS) (PROGN (PRINC MESS)
(SLEEP 1)
(VALUES)
)
)
(PROGN
(PRINC MESS1)
(SLEEP 2)
(VALUES)
)
(MAPCAR #'DELETE-FILE (DIRECTORY '{CORE}))
(SETQ NDIR-WINDOW (IL:CREATEW '(100 100 300 200) "NDIR WINDOW FOR TESTING"))
(IL:FOR X IL:TO 6
(PROGN (SETQ NDIR-STREAM
(IL:OPENTEXTSTREAM "THIS IS CONTENT OF NDIR-1" NDIR-WINDOW))
(IL:TEDIT.PUT NDIR-WINDOW (PACK* '{CORE}<NDIR> 'FILE X))
(CLOSE NDIR-STREAM)
)
)
(IL:CLOSEW NDIR-WINDOW)
(SETQ {CORE}NDIR-TEST "{CORE}NDIR-TEST")
(SETQ NDIR-COMMAND-STRING
"(MESSAGE MESS2)
(DRIBBLE '{CORE}NDIR-TEST)
NDIR {CORE}<NDIR>
(DRIBBLE)
(MESSAGE MESS3)
NDIR {CORE}<NDIR> CREATIONDATE SIZE
(SETQ FILES-EXIST-FLG NIL)
(SETQ X (OPEN {CORE}NDIR-TEST))
(DO ((CNT 1 (1+ CNT)))
((= CNT 7) T)
(IL:RATOM X))
(DOLIST (Y '(FILE1. FILE2. FILE3. FILE4. FILE5. FILE6.))
(PROGN (IF (EQ Y (IL:RATOM X))
(PUSH T FILES-EXIST-FLG)
(PUSH NIL FILES-EXIST-FLG))
(IL:RATOM X)
(IL:RATOM X)
)
)
(CLOSE X)
(MAPCAR #'DELETE-FILE (IL:DIRECTORY '{CORE}))
(MESSAGE MESS4)
(DO-TEST 'NDIR-TEST-RESULT
(PROG2 (SETQ *OUTPUT* (OPEN TEST-RESULT :DIRECTION :OUTPUT
:IF-EXISTS :APPEND))
(IF (NOTANY #'NULL FILES-EXIST-FLG)
(PROGN (R-FORMAT 'SUCCESS) T)
(PROGN (R-FORMAT 'FAIL) NIL))
(CLOSE *OUTPUT*)
)
)
")
(IL:BKSYSBUF NDIR-COMMAND-STRING)
)
)
STOP