;; Being tested: PromptForWord ;; ;; Source: ;; ;; Created By: Henry Cate III ;; ;; Creation Date: March 10, 1987 ;; ;; Last Update: ;; ;; Filed As: {eris}test>Keyboard>PromptForWord.u ;; ;; ;; (do-test "load the functions for the prompter for interactive tests" (if (not (fboundp 'do-test-menu-setup)) (load "{ERINYES}TOOLS>DO-TEST-MENU.dfasl")) T) (do-test-group "Testing PromptForWord" :before (progn (setq window-list (do-test-menu-Setup "PromptForWord"))) :after (progn (do-test-menu-Cleanup window-list)) (do-test "Check basic ReadNumber works" (let* ((user-result1 (do-test-menu-Message window-list 'high " Get to the Interlisp exec If there is no free Interlisp exec, bring up a another one. Place the cursor in the Interlisp exec. Indicate success when you get this far. ")) (command-string "(SETQ TEMPX (PROMPTFORWORD \"Type hello\"))") (toss-away (IL:BKSYSBUF command-string)) (user-result2 (do-test-menu-Message window-list 'high " Check basic ReadNumber works Enter \"hello\" and a CR. Was the prompt: \"Type hello\"? ")) (good-value (equal "hello" il:|TEMPX|))) (and user-result1 user-result2 (if (eq t user-result2) good-value T)) )) (do-test "Check can do candidate string" (let* ((user-result1 (do-test-menu-Message window-list 'high " Get to the Interlisp exec Indicate success when the cursor is in the Interlisp exec. ")) (command-string "(SETQ TEMPX (PROMPTFORWORD \"Type good-bye\" 'good-bye))") (toss-away (IL:BKSYSBUF command-string)) (user-result2 (do-test-menu-Message window-list 'high " Check can do candidate string Just press the space-bar. Does the line read: \"Type good-bye good-bye\"? ")) (good-value (equal "good-bye" il:|TEMPX|))) (and user-result1 user-result2 (if (eq t user-result2) good-value T)) )) (do-test "test returns nil when nothing is entered." (let* ((user-result1 (do-test-menu-Message window-list 'high " Get to the Interlisp exec Indicate success when the cursor is in the Interlisp exec. ")) (command-string "(SETQ TEMPX (PROMPTFORWORD \"Just press the tab key\"))") (toss-away (IL:BKSYSBUF command-string)) (user-result2 (do-test-menu-Message window-list 'high " test returns nil when nothing is entered Just press the tab key. Were you able to get this far? ")) (good-value (equal NIL il:|TEMPX|))) (and user-result1 user-result2 (if (eq t user-result2) good-value T)) )) (do-test "Test help." (let* ((user-result1 (do-test-menu-Message window-list 'high " Get to the Interlisp exec Indicate success when the cursor is in the Interlisp exec. ")) (command-string "(SETQ TEMPX (PROMPTFORWORD \"First question mark, then CR\" NIL \"This is a help message\"))") (toss-away (IL:BKSYSBUF command-string)) (user-result2 (do-test-menu-Message window-list 'high " Test help Type in \"?\" Then press CR. Was the following three lines printed out? First question mark, then CR This is a help message First question mark, then CR ")) (good-value (equal NIL il:|TEMPX|))) (and user-result1 user-result2 (if (eq t user-result2) good-value T)) )) (do-test "Test DONTECHOTYPEIN.FLG." (let* ((user-result1 (do-test-menu-Message window-list 'high " Get to the Interlisp exec Indicate success when the cursor is in the Interlisp exec. ")) (command-string "(SETQ TEMPX (PROMPTFORWORD \"Just CR\" \"password\" NIL NIL '*))") (toss-away (IL:BKSYSBUF command-string)) (user-result2 (do-test-menu-Message window-list 'high " Test DONTECHOTYPEIN.FLG Press CR. Was the prompt: \"Just CR ********\" ")) (good-value (equal "password" il:|TEMPX|))) (and user-result1 user-result2 (if (eq t user-result2) good-value T)) )) (do-test "Test urgency.option, part 1." (let* ((user-result1 (do-test-menu-Message window-list 'high " Get to the Interlisp exec Indicate success when the cursor is in the Interlisp exec. ")) (command-string "(SETQ TEMPX (PROMPTFORWORD \"Nothing\" \"smile\" NIL NIL NIL 1))") (toss-away (IL:BKSYSBUF command-string)) (user-result2 (do-test-menu-Message window-list 'high " Test urgency.option, part 1 Wait, it should continue on it's own after a second or two.. Was the prompt: \"Nothing smile\" And did it go on on its own? ")) (good-value (equal "smile" il:|TEMPX|))) (and user-result1 user-result2 (if (eq t user-result2) good-value T)) )) (do-test "Test urgency.option, part 2." (let* ((user-result1 (do-test-menu-Message window-list 'high " Get to the Interlisp exec Indicate success when the cursor is in the Interlisp exec. ")) (command-string "(SETQ TEMPX (PROMPTFORWORD \"Wait, then CR\" \"smile\" NIL NIL NIL T))") (toss-away (IL:BKSYSBUF command-string)) (user-result2 (do-test-menu-Message window-list 'high " Test urgency.option, part 2 Wait for a minute. Then press the CR. Did the exec window flash? ")) (good-value (equal "smile" il:|TEMPX|))) (and user-result1 user-result2 (if (eq t user-result2) good-value T)) )) (do-test "Test terminating character list." (let* ((user-result1 (do-test-menu-Message window-list 'high " Get to the Interlisp exec Indicate success when the cursor is in the Interlisp exec. ")) (command-string "(SETQ TEMPX (PROMPTFORWORD \"Type 12345\" NIL NIL NIL NIL NIL (CHARCODE (5 6 7))))") (toss-away (IL:BKSYSBUF command-string)) (user-result2 (do-test-menu-Message window-list 'high " Test terminating character list Type: \"12345\" Did it return after the number \"5\"? ")) (good-value (equal "1234" il:|TEMPX|))) (and user-result1 user-result2 (if (eq t user-result2) good-value T)) )) (do-test "Try in XCL." (let* ((user-result1 (do-test-menu-Message window-list 'high " Get to a XCL exec If needed bring up another XCL exec. Indicate success when the cursor is in the XCL exec. ")) (command-string "(cl:in-package 'xcl-test) (SETQ TEMPX (il:PROMPTFORWORD \"Type 12345\" ))") (toss-away (IL:BKSYSBUF command-string)) (user-result2 (do-test-menu-Message window-list 'high " Try in XCL Type: \"12345\" Then a CR Were you able to get this far? ")) (good-value (equal "12345" TEMPX))) (and user-result1 user-result2 (if (eq t user-result2) good-value T)) )) ) ; end of do-test-group STOP