1
1
# This file is a Tcl script to test the [tcl_startOf|endOf]* functions in
2
2
# word.tcl. It is organized in the standard fashion for Tcl tests.
3
3
#
4
- # Copyright (c) 2024 Jan Nijtmans
4
+ # Copyright © 2024 Jan Nijtmans
5
5
# All rights reserved.
6
6
7
7
if {"::tcltest" ni [namespace children]} {
@@ -12,174 +12,159 @@ if {"::tcltest" ni [namespace children]} {
12
12
::tcltest::loadTestedCommands
13
13
catch [list package require -exact tcl::test [info patchlevel]]
14
14
15
- test word-3 .0 {tcl_endOfWord} -body {
15
+ test word-1 .0 {tcl_endOfWord} -body {
16
16
tcl_endOfWord "ab cd" -1
17
17
} -result 2
18
- test word-3 .1 {tcl_endOfWord} -body {
18
+ test word-1 .1 {tcl_endOfWord} -body {
19
19
tcl_endOfWord "ab cd" 0
20
20
} -result 2
21
- test word-3 .2 {tcl_endOfWord} -body {
21
+ test word-1 .2 {tcl_endOfWord} -body {
22
22
tcl_endOfWord "ab cd" 1
23
23
} -result 2
24
- test word-3 .3 {tcl_endOfWord} -body {
24
+ test word-1 .3 {tcl_endOfWord} -body {
25
25
tcl_endOfWord "ab cd" 2
26
26
} -result -1
27
- test word-3 .4 {tcl_endOfWord} -body {
27
+ test word-1 .4 {tcl_endOfWord} -body {
28
28
tcl_endOfWord "ab cd" 3
29
29
} -result -1
30
- test word-3 .5 {tcl_endOfWord} -body {
30
+ test word-1 .5 {tcl_endOfWord} -body {
31
31
tcl_endOfWord "ab cd" 4
32
32
} -result -1
33
- test word-3 .6 {tcl_endOfWord} -body {
33
+ test word-1 .6 {tcl_endOfWord} -body {
34
34
tcl_endOfWord "ab cd" 5
35
35
} -result -1
36
- test word-3 .7 {tcl_endOfWord} -body {
36
+ test word-1 .7 {tcl_endOfWord} -body {
37
37
tcl_endOfWord "ab cd" end
38
38
} -result -1
39
- test word-3.8 {tcl_endOfWord} -body {
40
- tcl_endOfWord "ab cd" {}
41
- } -result 2
42
- test word-3.9 {tcl_endOfWord} -body {
39
+ test word-1.8 {tcl_endOfWord} -body {
43
40
tcl_endOfWord "ab cd" end-1
44
41
} -result -1
45
42
46
- test word-4 .0 {tcl_startOfPreviousWord} -body {
43
+ test word-2 .0 {tcl_startOfPreviousWord} -body {
47
44
tcl_startOfPreviousWord "ab cd" -1
48
45
} -result -1
49
- test word-4 .1 {tcl_startOfPreviousWord} -body {
46
+ test word-2 .1 {tcl_startOfPreviousWord} -body {
50
47
tcl_startOfPreviousWord "ab cd" 0
51
48
} -result -1
52
- test word-4 .2 {tcl_startOfPreviousWord} -body {
49
+ test word-2 .2 {tcl_startOfPreviousWord} -body {
53
50
tcl_startOfPreviousWord "ab cd" 1
54
51
} -result 0
55
- test word-4 .3 {tcl_startOfPreviousWord} -body {
52
+ test word-2 .3 {tcl_startOfPreviousWord} -body {
56
53
tcl_startOfPreviousWord "ab cd" 2
57
54
} -result 0
58
- test word-4 .4 {tcl_startOfPreviousWord} -body {
55
+ test word-2 .4 {tcl_startOfPreviousWord} -body {
59
56
tcl_startOfPreviousWord "ab cd" 3
60
57
} -result 0
61
- test word-4 .5 {tcl_startOfPreviousWord} -body {
58
+ test word-2 .5 {tcl_startOfPreviousWord} -body {
62
59
tcl_startOfPreviousWord "ab cd" 4
63
60
} -result 3
64
- test word-4 .6 {tcl_startOfPreviousWord} -body {
61
+ test word-2 .6 {tcl_startOfPreviousWord} -body {
65
62
tcl_startOfPreviousWord "ab cd" 5
66
63
} -result 3
67
- test word-4 .7 {tcl_startOfPreviousWord} -body {
64
+ test word-2 .7 {tcl_startOfPreviousWord} -body {
68
65
tcl_startOfPreviousWord "ab cd" end
69
66
} -result 3
70
- test word-4.8 {tcl_startOfPreviousWord} -body {
71
- tcl_startOfPreviousWord "ab cd" {}
72
- } -result -1
73
- test word-4.9 {tcl_startOfPreviousWord, bug [16e25e1402]} -body {
67
+ test word-2.8 {tcl_startOfPreviousWord, bug [16e25e1402]} -body {
74
68
tcl_startOfPreviousWord "ab cd" end-1
75
69
} -result 0
76
70
77
- test word-5 .0 {tcl_startOfNextWord} -body {
71
+ test word-3 .0 {tcl_startOfNextWord} -body {
78
72
tcl_startOfNextWord "ab cd" -1
79
73
} -result 3
80
- test word-5 .1 {tcl_startOfNextWord} -body {
74
+ test word-3 .1 {tcl_startOfNextWord} -body {
81
75
tcl_startOfNextWord "ab cd" 0
82
76
} -result 3
83
- test word-5 .2 {tcl_startOfNextWord} -body {
77
+ test word-3 .2 {tcl_startOfNextWord} -body {
84
78
tcl_startOfNextWord "ab cd" 1
85
79
} -result 3
86
- test word-5 .3 {tcl_startOfNextWord} -body {
80
+ test word-3 .3 {tcl_startOfNextWord} -body {
87
81
tcl_startOfNextWord "ab cd" 2
88
82
} -result 3
89
- test word-5 .4 {tcl_startOfNextWord} -body {
83
+ test word-3 .4 {tcl_startOfNextWord} -body {
90
84
tcl_startOfNextWord "ab cd" 3
91
85
} -result -1
92
- test word-5 .5 {tcl_startOfNextWord} -body {
86
+ test word-3 .5 {tcl_startOfNextWord} -body {
93
87
tcl_startOfNextWord "ab cd" 4
94
88
} -result -1
95
- test word-5 .6 {tcl_startOfNextWord} -body {
89
+ test word-3 .6 {tcl_startOfNextWord} -body {
96
90
tcl_startOfNextWord "ab cd" 5
97
91
} -result -1
98
- test word-5 .7 {tcl_startOfNextWord} -body {
92
+ test word-3 .7 {tcl_startOfNextWord} -body {
99
93
tcl_startOfNextWord "ab cd" end
100
94
} -result -1
101
- test word-5.8 {tcl_startOfNextWord} -body {
102
- tcl_startOfNextWord "ab cd" {}
103
- } -result 3
104
- test word-5.9 {tcl_startOfNextWord} -body {
95
+ test word-3.8 {tcl_startOfNextWord} -body {
105
96
tcl_startOfNextWord "ab cd" end-1
106
97
} -result -1
107
98
108
- test word-6 .0 {tcl_wordBreakBefore} -body {
99
+ test word-4 .0 {tcl_wordBreakBefore} -body {
109
100
tcl_wordBreakBefore "ab cd" -1
110
101
} -result -1
111
- test word-6 .1 {tcl_wordBreakBefore} -body {
102
+ test word-4 .1 {tcl_wordBreakBefore} -body {
112
103
tcl_wordBreakBefore "ab cd" 0
113
104
} -result -1
114
- test word-6 .2 {tcl_wordBreakBefore} -body {
105
+ test word-4 .2 {tcl_wordBreakBefore} -body {
115
106
tcl_wordBreakBefore "ab cd" 1
116
107
} -result -1
117
- test word-6 .3 {tcl_wordBreakBefore} -body {
108
+ test word-4 .3 {tcl_wordBreakBefore} -body {
118
109
tcl_wordBreakBefore "ab cd" 2
119
110
} -result 2
120
- test word-6 .4 {tcl_wordBreakBefore} -body {
111
+ test word-4 .4 {tcl_wordBreakBefore} -body {
121
112
tcl_wordBreakBefore "ab cd" 3
122
113
} -result 3
123
- test word-6 .5 {tcl_wordBreakBefore} -body {
114
+ test word-4 .5 {tcl_wordBreakBefore} -body {
124
115
tcl_wordBreakBefore "ab cd" 4
125
116
} -result 3
126
- test word-6 .6 {tcl_wordBreakBefore} -body {
117
+ test word-4 .6 {tcl_wordBreakBefore} -body {
127
118
tcl_wordBreakBefore "ab cd" 5
128
119
} -result 3
129
- test word-6 .7 {tcl_wordBreakBefore} -body {
120
+ test word-4 .7 {tcl_wordBreakBefore} -body {
130
121
tcl_wordBreakBefore "ab cd" end
131
122
} -result 3
132
- test word-6.8 {tcl_wordBreakBefore} -body {
133
- tcl_wordBreakBefore "ab cd" {}
134
- } -result -1
135
- test word-6.9 {tcl_wordBreakBefore} -body {
123
+ test word-4.8 {tcl_wordBreakBefore} -body {
136
124
tcl_startOfNextWord "ab cd" end-1
137
125
} -result -1
138
126
139
- test word-7 .0 {tcl_wordBreakAfter} -body {
127
+ test word-5 .0 {tcl_wordBreakAfter} -body {
140
128
tcl_wordBreakAfter "ab cd" -1
141
129
} -result 2
142
- test word-7 .1 {tcl_wordBreakAfter} -body {
130
+ test word-5 .1 {tcl_wordBreakAfter} -body {
143
131
tcl_wordBreakAfter "ab cd" 0
144
132
} -result 2
145
- test word-7 .2 {tcl_wordBreakAfter} -body {
133
+ test word-5 .2 {tcl_wordBreakAfter} -body {
146
134
tcl_wordBreakAfter "ab cd" 1
147
135
} -result 2
148
- test word-7 .3 {tcl_wordBreakAfter} -body {
136
+ test word-5 .3 {tcl_wordBreakAfter} -body {
149
137
tcl_wordBreakAfter "ab cd" 2
150
138
} -result 3
151
- test word-7 .4 {tcl_wordBreakAfter} -body {
139
+ test word-5 .4 {tcl_wordBreakAfter} -body {
152
140
tcl_wordBreakAfter "ab cd" 3
153
141
} -result -1
154
- test word-7 .5 {tcl_wordBreakAfter} -body {
142
+ test word-5 .5 {tcl_wordBreakAfter} -body {
155
143
tcl_wordBreakAfter "ab cd" 4
156
144
} -result -1
157
- test word-7 .6 {tcl_wordBreakAfter} -body {
145
+ test word-5 .6 {tcl_wordBreakAfter} -body {
158
146
tcl_wordBreakAfter "ab cd" 5
159
147
} -result -1
160
- test word-7 .7 {tcl_wordBreakAfter} -body {
148
+ test word-5 .7 {tcl_wordBreakAfter} -body {
161
149
tcl_wordBreakAfter "ab cd" end
162
150
} -result -1
163
- test word-7.8 {tcl_wordBreakAfter} -body {
164
- tcl_wordBreakAfter "ab cd" {}
165
- } -result 2
166
- test word-7.9 {tcl_wordBreakAfter} -body {
151
+ test word-5.8 {tcl_wordBreakAfter} -body {
167
152
tcl_wordBreakAfter "ab cd" end-1
168
153
} -result -1
169
154
170
- test word-8.2 {tcl_startOfPreviousWord} -body {
155
+ test word-6.0 {tcl_startOfPreviousWord} -body {
171
156
tcl_startOfPreviousWord a b c d
172
157
} -returnCodes 1 -result {wrong # args: should be "tcl_startOfPreviousWord str start"}
173
- test word-8.3 {tcl_startOfNextWord} -body {
158
+ test word-6.1 {tcl_startOfNextWord} -body {
174
159
tcl_startOfNextWord a b c d
175
160
} -returnCodes 1 -result {wrong # args: should be "tcl_startOfNextWord str start"}
176
- test word-8.4 {tcl_endOfWord} -body {
161
+ test word-6.2 {tcl_endOfWord} -body {
177
162
tcl_endOfWord a b c d
178
163
} -returnCodes 1 -result {wrong # args: should be "tcl_endOfWord str start"}
179
- test word-8.5 {tcl_wordBreakBefore} -body {
164
+ test word-6.3 {tcl_wordBreakBefore} -body {
180
165
tcl_wordBreakBefore a b c d
181
166
} -returnCodes 1 -result {wrong # args: should be "tcl_wordBreakBefore str start"}
182
- test word-8.6 {tcl_wordBreakAfter} -body {
167
+ test word-6.4 {tcl_wordBreakAfter} -body {
183
168
tcl_wordBreakAfter a b c d
184
169
} -returnCodes 1 -result {wrong # args: should be "tcl_wordBreakAfter str start"}
185
170
0 commit comments