1
0
mirror of synced 2026-01-17 00:52:40 +00:00

384 lines
16 KiB
Plaintext

;; Being tested: SEdit
;;
;; Source: {ERIS}<LispCore>DOC>SEDIT>SEDIT.TEDIT
;;
;; Created By: Henry Cate III
;;
;; Creation Date: February 21, 1987
;;
;; Last Update:
;;
;; Filed As: {eris}<lispcore>test>SEdit>command-substitute.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 "Substitute"
:before (progn
(setq window-list (do-test-menu-Setup "Substitute")))
:after (progn
(do-test-menu-Cleanup window-list))
(do-test "Substitute: no selection/no caret"
(let* ((user-result (do-test-menu-Message window-list 'high
" Testing Substitute
If there is no free Xerox Common Lisp exec, bring up a another one and type: \"(cl:in-package 'xcl-test)\"
In the exec type:
(setq tempx '(1 4.5 6/7 a cd efg \"hello\" \"BYE\" (bye) (\"hi\" (b) cd 4)))
(il:dv tempx)
Select Substitute from the pop up menu.
Does SEdit display in the SEdit prompt window:
\"Please select a structure to substitute within.\"? "))
(good-value (equal '(1 4.5 6/7 a cd efg "hello" "BYE" (bye) ("hi" (b) cd 4)) tempx)))
(and user-result (if (eq t user-result) good-value T))
))
(do-test "Substitute: no selection/edit caret"
(do-test-menu-Message window-list 'low
" Testing: no selection/edit caret
Assuming SEdit is editing the variable tempx which currently equals:
(1 4.5 6/7 a cd efg \"hello\" \"BYE\" (bye) (\"hi\" (b) cd 4))
Select DONE from the SEdit popup menu.
Want to place the edit caret right after the 1 without selecting it. Do this by pressing the left mouse button with the mouse cursor just to the right of the 1.
Type meta-S.
Does SEdit display in the SEdit prompt window:
\"Please select a structure to substitute within.\"? "))
(do-test "Substitute: no selection/structure caret"
(do-test-menu-Message window-list 'low
" Testing: no selection/structure caret
Assuming SEdit is editing the variable tempx which currently equals:
(1 4.5 6/7 a cd efg \"hello\" \"BYE\" (bye) (\"hi\" (b) cd 4))
Want to place the structure caret right between \"(b)\" and \"cd\" without selecting either item. Do this by positioning the mouse cursor between the two items and press the middle button.
Type meta-S.
Does SEdit display in the SEdit prompt window:
\"Please select a structure to substitute within.\"? "))
(do-test "Substitute: select a litatom"
(let* ((user-result (do-test-menu-Message window-list 'low
" Testing: select a litatom
Assuming SEdit is editing the variable tempx which currently equals:
(1 4.5 6/7 a cd efg \"hello\" \"BYE\" (bye) \"hi\" (b) cd 4))
Select the first litatom \"cd\" as a structure, by pressing the left mouse button twice with the cursor over the litatom.
Type meta-S.
Enter the litatom \"cd\" then the litatom \"cde\"
Does SEdit display in the SEdit prompt window:
\"1 substitution made.\"? "))
(good-value (equal '(1 4.5 6/7 a cde efg "hello" "BYE" (bye) ("hi" (b) cd 4)) tempx)))
(and user-result (if (eq t user-result) good-value T))
))
(do-test "Substitute: select a string"
(let* ((user-result (do-test-menu-Message window-list 'low
" Testing: select a string
Assuming SEdit is editing the variable tempx which currently equals:
(1 4.5 6/7 a cde efg \"hello\" \"BYE\" (bye) (\"hi\" (b) cd 4))
Type meta-U.
Select the string \"hello\" as a structure, by pressing the left mouse button twice with the cursor over the string.
Type meta-S.
Enter the string \"hello\" (with quotes) then the string \"HELLO\" (with quotes).
Does SEdit display in the SEdit prompt window:
\"1 substitution made.\"? "))
(good-value (equal '(1 4.5 6/7 a cd efg "HELLO" "BYE" (bye) ("hi" (b) cd 4)) tempx)))
(and user-result (if (eq t user-result) good-value T))
))
(do-test "Substitute: select a number"
(let* ((user-result (do-test-menu-Message window-list 'low
" Testing: select a number
Assuming SEdit is editing the variable tempx which currently equals:
(1 4.5 6/7 a cd efg \"HELLO\" \"BYE\" (bye) (\"hi\" (b) cd 4))
Type meta-U.
Select the number \"4.5\" as a structure, by pressing the left mouse button twice with the cursor over the number.
Type meta-S.
Enter the number \"4.5\" then the number \"5.4\"
Does SEdit display in the SEdit prompt window:
\"1 substitution made.\"? "))
(good-value (equal '(1 5.4 6/7 a cd efg "hello" "BYE" (bye) ("hi" (b) cd 4)) tempx)))
(and user-result (if (eq t user-result) good-value T))
))
(do-test "Substitute: select a list"
(let* ((user-result (do-test-menu-Message window-list 'low
" Testing: select a list
Assuming SEdit is editing the variable tempx which currently equals:
(1 5.4 6/7 a cd efg \"hello\" \"BYE\" (bye) (\"hi\" (b) cd 4))
Type meta-U.
Select the list \"(bye)\" as a structure, by pressing the left mouse button three times with the cursor over the \"y\".
Type meta-S.
Enter the list \"(bye)\" then the list \"(bye now)\"
Does SEdit display in the SEdit prompt window:
\"1 substitution made.\"? "))
(good-value (equal '(1 4.5 6/7 a cd efg "hello" "BYE" (bye now) ("hi" (b) cd 4)) tempx)))
(and user-result (if (eq t user-result) good-value T))
))
(do-test "Substitute: select part of a litatom"
(do-test-menu-Message window-list 'low
" Testing: select part of a litatom
Assuming SEdit is editing the variable tempx which currently equals:
(1 4.5 6/7 a cd efg \"hello\" \"BYE\" (bye now) (\"hi\" (b) cd 4))
Type meta-U.
Select the \"d\" in the first litatom \"cd\".
Type meta-S.
Does SEdit display in the SEdit prompt window:
\"Please select a structure to substitute within.\"? "))
(do-test "Substitute: select part of a string"
(do-test-menu-Message window-list 'low
" Testing: select part of a string
Assuming SEdit is editing the variable tempx which currently equals:
(1 4.5 6/7 a cd efg \"hello\" \"BYE\" (bye) (\"hi\" (b) cd 4))
Select the \"h\" in the string \"hello\".
Type meta-S.
Does SEdit display in the SEdit prompt window:
\"Please select a structure to substitute within.\"? "))
(do-test "Substitute: select part of a number"
(do-test-menu-Message window-list 'low
" Testing: select part of a number
Assuming SEdit is editing the variable tempx which currently equals:
(1 4.5 6/7 a cd efg \"hello\" \"BYE\" (bye) (\"hi\" (b) cd 4))
Select the \"7\" in the number \"6/7\".
Type meta-S.
Does SEdit display in the SEdit prompt window:
\"Please select a structure to substitute within.\"? "))
(do-test "Substitute: pending delete of a litatom"
(let* ((user-result (do-test-menu-Message window-list 'low
" Testing: pending delete of litatom
Assuming SEdit is editing the variable tempx which currently equals:
(1 4.5 6/7 a cd efg \"hello\" \"BYE\" (bye) (\"hi\" (b) cd 4))
Select the litatom \"efg\" in pending delete mode by first pressing the left button of the mouse with the cursor on the \"e\" and then pressing the right button withe the cursor on the \"g\". This should create a box around the litatom \"efg\".
Type meta-S.
First enter the litatom \"efg\" then the number \"999\".
Does SEdit display in the SEdit prompt window:
\"1 substitution made.\"? "))
(good-value (equal '(1 4.5 6/7 a cd 999 "hello" "BYE" (bye) ("hi" (b) cd 4)) tempx)))
(and user-result (if (eq t user-result) good-value T))
))
(do-test "Substitute: pending delete of a string"
(let* ((user-result (do-test-menu-Message window-list 'low
" Testing: pending delete of a string
Assuming SEdit is editing the variable tempx which currently equals:
(1 4.5 6/7 a cd 999 \"hello\" \"BYE\" (bye) (\"hi\" (b) cd 4))
Type meta-U.
Select the string \"hello\" in pending delete mode bye clicking on the \"h\", then pressing the right mouse button with the cursor to the right of the string.
Type meta-S.
First enter the string \"hello\" (with quotes) then the litatom \"we-2\" (without quotes).
Does SEdit display in the SEdit prompt window:
\"1 substitution made.\"? "))
(good-value (equal '(1 4.5 6/7 a cd efg we-2 "BYE" (bye) ("hi" (b) cd 4)) tempx)))
(and user-result (if (eq t user-result) good-value T))
))
(do-test "Substitute: pending delete a number"
(let* ((user-result (do-test-menu-Message window-list 'low
" Testing: pending delete of a number
Assuming SEdit is editing the variable tempx which currently equals:
(1 4.5 6/7 a cd efg we-2 \"BYE\" (bye) (\"hi\" (b) cd 4))
Type meta-U.
Select the number \"4.5\" in pending delete mode.
Type meta-S.
Enter the number \"4.5\", then the list \"(a b c d)\".
Does SEdit display in the SEdit prompt window:
\"1 substitution made.\"? "))
(good-value (equal '(1 (a b c d) 6/7 a cd efg "hello" "BYE" (bye) ("hi" ;(b) cd 4)) tempx)))
(and user-result (if (eq t user-result) good-value T))
))
(do-test "Substitute: pending delete of a list"
(let* ((user-result (do-test-menu-Message window-list 'low
" Testing: pending delete of a list
Assuming SEdit is editing the variable tempx which currently equals:
(1 4.5 6/7 a cd efg we-2 \"BYE\" (bye) (\"hi\" (b) cd 4))
Type meta-U.
Select the list \"(bye)\" in pending delete mode.
Type meta-S.
Enter the list \"(bye)\", then the number \"2\"
Does SEdit display in the SEdit prompt window:
\"1 substitution made.\"? "))
(good-value (equal '(1 4.5 6/7 a cd efg "hello" "BYE" 2 ("hi" (b) cd 4)) tempx)))
(and user-result (if (eq t user-result) good-value T))
))
(do-test "Substitute: extended selection of litatoms"
(let* ((user-result (do-test-menu-Message window-list 'low
" Testing: try extended selection of litatoms
Assuming SEdit is editing the variable tempx which currently equals:
(1 4.5 6/7 a cd efg \"hello\" \"BYE\" 2 (\"hi\" (b) cd 4))
Type meta-U.
Select the litatom \"a\" as a structure, and extend the selection to include the next two litatoms.
Type meta-S
Enter the litatom \"a\", then the string \"Wedding song\"
Does SEdit display in the SEdit prompt window:
\"1 substitution made.\"? "))
(good-value (equal '(1 4.5 6/7 "Wedding song" cd efg "hello" "BYE" (bye) ("hi" (b) cd 4)) tempx)))
(and user-result (if (eq t user-result) good-value T))
))
(do-test "Substitute: extended selection of strings"
(let* ((user-result (do-test-menu-Message window-list 'low
" Testing: extended selection of strings
Assuming SEdit is editing the variable tempx which currently equals:
(1 4.5 6/7 \"Wedding song\" cd efg \"hello\" \"BYE\" (bye) (\"hi\" (b) cd 4))
Type meta-U.
Now select the string \"hello\" as a structure, and extend the selection to include the second string.
Type meta-S
First enter the string \"hello\", then the number \"12\"
Does SEdit display in the SEdit prompt window:
\"1 substitution made.\"? "))
(good-value (equal '(1 4.5 6/7 a cd efg 12 "BYE" (bye) ("hi" (b) cd 4)) tempx)))
(and user-result (if (eq t user-result) good-value T))
))
(do-test "Substitute: extended selection of numbers"
(let* ((user-result (do-test-menu-Message window-list 'low
" Testing: extended selection of numbers
Assuming SEdit is editing the variable tempx which currently equals:
(1 4.5 6/7 a cd efg 12 \"BYE\" (bye) (\"hi\" (b) cd 4))
Type meta-U.
Select the number \"1\" as a structure, and extend the selection to include the next two numbers.
Type meta-S.
First enter the number \"6/7\", then the list \"(56 65)\"
Does SEdit display in the SEdit prompt window:
\"1 substitution made.\"? "))
(good-value (equal '(1 4.5 (56 65) a cd efg "hello" "BYE" (bye) ("hi" (b) cd 4)) tempx)))
(and user-result (if (eq t user-result) good-value T))
))
(do-test "Substitute: extended selection of lists"
(let* ((user-result (do-test-menu-Message window-list 'low
" Testing: extended selection of lists
Assuming SEdit is editing the variable tempx which currently equals:
(1 4.5 (56 65) a cd efg \"hello\" \"BYE\" (bye) (\"hi\" (b) cd 4))
Type meta-U.
Select the list \"(bye)\" as a structure, and extend the selection to include the next list.
Type meta-S.
First enter the list \"(b)\", then the litatom \"bcd\"
Does SEdit display in the SEdit prompt window:
\"1 substitution made.\"? "))
(good-value (equal '(1 4.5 6/7 a cd efg "hello" "BYE" (bye) ("hi" bcd cd 4)) tempx)))
(and user-result (if (eq t user-result) good-value T))
))
(do-test "Substitute: extended selection of litatoms and numbers"
(let* ((user-result (do-test-menu-Message window-list 'low
" Testing: extended selection of litatoms and numbers
Assuming SEdit is editing the variable tempx which currently equals:
(1 4.5 6/7 a cd efg \"hello\" \"BYE\" (bye) (\"hi\" bcd cd 4))
Type meta-U.
Select the number \"1\" as a structure, and extend the selection to include the next five items.
Type meta-S.
First enter the number \"1\", then the litatom \"qw\"
Does SEdit display in the SEdit prompt window:
\"1 substitution made.\"? "))
(good-value (equal '(qw 4.5 6/7 a cd efg "hello" "BYE" (bye) ("hi" (b) cd 4)) tempx)))
(and user-result (if (eq t user-result) good-value T))
))
(do-test "Substitute: extended selection of strings and lists"
(let* ((user-result (do-test-menu-Message window-list 'low
" Testing: extended selection of strings and lists
Assuming SEdit is editing the variable tempx which currently equals:
(qw 4.5 6/7 a cd efg \"hello\" \"BYE\" (bye) (\"hi\" (b) cd 4))
Type meta-U.
Select the string \"hello\" as a structure, and extend the selection to include the next three items.
Type meta-S.
First enter the string \"BYE\", then the number \"7878\"
Does SEdit display in the SEdit prompt window:
\"1 substitution made.\"? "))
(good-value (equal '(1 4.5 6/7 a cd efg "hello" 7878 (bye) ("hi" (b) cd 4)) tempx)))
(and user-result (if (eq t user-result) good-value T))
))
(do-test "Substitute: extended selection of several things"
(let* ((user-result (do-test-menu-Message window-list 'low
" Testing: extended selection of several things
Assuming SEdit is editing the variable tempx which currently equals:
(1 4.5 6/7 a cd efg \"hello\" 7878 (bye) (\"hi\" (b) cd 4))
Type meta-U.
Select the number \"1\" as a structure, and extend the selection to include the rest.
Type meta-S.
First enter the litatom \"cd\", then the litatom \"gh\"
Does SEdit display in the SEdit prompt window:
\"2 substitutions made.\"? "))
(good-value (equal '(1 4.5 6/7 a gh efg "hello" "BYE" (bye) ("hi" (b) gh 4)) tempx)))
(and user-result (if (eq t user-result) good-value T))
))
(do-test "Substitute: selection of entire structure"
(let* ((user-result (do-test-menu-Message window-list 'low
" Testing: selection of entire structure
Assuming SEdit is editing the variable tempx which currently equals:
(1 4.5 6/7 a gh efg \"hello\" \"BYE\" (bye) (\"hi\" (b) gh 4))
Type meta-U.
Select the entire structure.
Type meta-S.
First enter the string \"Should not change value\", then the litatom \"not-there\"
Does SEdit display in the SEdit prompt window:
\"No substitutions made.\"? "))
(good-value (equal '(1 4.5 6/7 a cd efg "hello" "BYE" (bye) ("hi" (b) cd 4)) tempx)))
(and user-result (if (eq t user-result) good-value T))
))
(do-test "Substitute: Pending delete of whole structure"
(let* ((user-result (do-test-menu-Message window-list 'low
" Testing: selection of entire structure
Assuming SEdit is editing the variable tempx which currently equals:
(1 4.5 6/7 a cd efg \"hello\" \"BYE\" (bye) (\"hi\" (b) cd 4))
Type meta-U.
Select the entire structure in pending delete mode.
Type meta-m.
Enter the number 4 in the FIND field. and the number 5 in the SUBSTITUTE field.
Pick the substitute command on the attached menu.
Does SEdit display in the SEdit prompt window:
\"1 substitution made.\"? "))
(good-value (equal '(1 4.5 6/7 a cd efg "hello" "BYE" (bye) ("hi" (b) cd 5)) tempx)))
(and user-result (if (eq t user-result) good-value T))
))
(do-test "Clean up"
(do-test-menu-message window-list 'high
"Close the SEdit window by selecting EXIT from the attached menu."))
) ; end of do-test-group
STOP