1
0
mirror of synced 2026-01-15 16:26:26 +00:00
2020-12-16 18:21:28 -08:00

143 lines
4.7 KiB
Plaintext

;; Being tested: AskUser
;;
;; Source:
;;
;; Created By: Henry Cate III
;;
;; Creation Date: March 6, 1987
;;
;; Last Update:
;;
;; Filed As: {eris}<lispcore>test>Keyboard>AskUser.u
;;
;;
;;
(do-test "load the functions for the prompter for interactive tests"
(if (not (fboundp 'do-test-menu-setup))
(load "{ERINYES}<test>TOOLS>DO-TEST-MENU.dfasl"))
T)
(do-test-group "Testing AskUser"
:before (progn
(setq window-list (do-test-menu-Setup "AskUser")))
:after (progn
(do-test-menu-Cleanup window-list))
(do-test "Test TTYIN in the Interlisp exec"
(let* ((user-result1 (do-test-menu-Message window-list 'high
" Test TTYIN in the Interlisp exec
If there is no free Interlisp exec, bring up a another one.
Put the cursor in it.
Indicate success when you get this far. "))
(command-string
"(SETQ TEMP-KEY-LIST (MAKEKEYLST
'(GREETINGS HELLO SALUTATIONS) NIL NIL T))
(SETQ TEMPX (ASKUSER NIL NIL \"Type a H \" TEMP-KEY-LIST))")
(toss-away (IL:BKSYSBUF command-string))
(user-result2 (do-test-menu-Message window-list 'high
" Check basic ASKUSER workds
Type an \"H\" and then a carriage return.
Were you able to get this far? "))
(good-value (equal 'il:hello il:|TEMPX|)))
(and user-result1 user-result2 (if (eq t user-result2) good-value T))
))
(do-test "TTYIN, test default in the Interlisp Exec"
(let* ((user-result1 (do-test-menu-Message window-list 'high
" TTYIN, test default in the Interlisp Exec
Indicate success when the cursor is in the Interlisp Exec. "))
(command-string
"(SETQ TEMP-KEY-LIST (MAKEKEYLST
'(GREETINGS HELLO SALUTATIONS) NIL NIL T))
(SETQ TEMPX (ASKUSER 1 'G \"Just CR \" TEMP-KEY-LIST))")
(toss-away (IL:BKSYSBUF command-string))
(user-result2 (do-test-menu-Message window-list 'high
" Check ASKUSER can default
Wait for ASKUSER to prompt with
\"Just CR ...GREETINGS\"
and then press the CR.
Were you able to get this far? "))
(good-value (equal 'il:greetings il:|TEMPX|)))
(and user-result1 user-result2 (if (eq t user-result2) good-value T))
))
(do-test "Test TTYIN in the XCL exec"
(let* ((user-result1 (do-test-menu-Message window-list 'high
" Test TTYIN in the XCL exec
If there is no free XCL exec, bring up a another one.
Put the cursor in it.
Indicate success when you get this far. "))
(command-string
"(cl:in-package 'xcl-test)
(setq temp-key-list (il:makekeylst
'(GREETINGS HELLO SALUTATIONS) nil nil T))
(setq tempx (il:askuser nil nil \"Type a H \" temp-key-list))")
(toss-away (IL:BKSYSBUF command-string))
(user-result2 (do-test-menu-Message window-list 'high
" Check ASKUSER works in an XCL exec
Type an \"H\" and then a carriage return.
Were you able to get this far? "))
(good-value (equal 'hello tempx)))
(and user-result1 user-result2 (if (eq t user-result2) good-value T))
))
(do-test "TTYIN, test default in the XCL exec"
(let* ((user-result1 (do-test-menu-Message window-list 'high
" TTYIN, test default in the XCL exec
Indicate success when the cursor is in the XCL Exec. "))
(command-string
"(setq temp-key-list (il:makekeylst
'(GREETINGS HELLO SALUTATIONS) nil nil T))
(setq tempx (il:askuser 100 'il:G \"Just CR \" temp-key-list))")
(toss-away (IL:BKSYSBUF command-string))
(user-result2 (do-test-menu-Message window-list 'high
" Check ASKUSER can default in an XCL exec
Wait until the exec reads:
\"Just CR ...GREETINGS\"
Then press CR.
Were you able to get this far? "))
(good-value (equal 'greetings TEMPX)))
(and user-result1 user-result2 (if (eq t user-result2) good-value T))
))
(do-test "TTYIN, test reaing from a STREAM"
(let* ((user-result1 (do-test-menu-Message window-list 'high
" TTYIN, test reading from a STREAM
Indicate success when the cursor is in the XCL Exec. "))
(command-string
"(setq temp-key-list (il:makekeylst
'(GREETINGS HELLO SALUTATIONS) nil nil T))
(setq temp-pathname (make-pathname :host \"core\"
:directory \"cmltest\" :name (string (gensym))))
(setq temp-stream (cl:open temp-pathname :direction :output))
(write-line \"S\" temp-stream)
(write-line \" \" temp-stream)
(close temp-stream)
(setq temp-stream (open temp-pathname :direction :input))
(setq tempx (il:askuser nil nil \"Just CR \" temp-key-list T T nil temp-stream))")
(toss-away (IL:BKSYSBUF command-string))
(user-result2 (do-test-menu-Message window-list 'high
" Check ASKUSER can read from STREAM
Inidcate success when the call to ASKUSER is made. "))
(toss-away2 (and (close temp-stream) (delete-file temp-pathname)))
(good-value (equal 'salutations tempx)))
(and user-result1 user-result2 (if (eq t user-result2) good-value T))
))
) ; end of do-test-group
STOP