Skip to content

Commit 4c4354b

Browse files
author
jan.nijtmans
committed
Merge 8.6
2 parents b098e6a + 854b784 commit 4c4354b

File tree

2 files changed

+52
-67
lines changed

2 files changed

+52
-67
lines changed

library/word.tcl

+1-1
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ proc tcl_startOfPreviousWord {str start} {
148148
variable ::tcl::WordBreakRE
149149
set word {-1 -1}
150150
if {$start > 0} {
151-
regexp -indices -- $WordBreakRE(previous) [string range [string range $str 0 $start] 0 end-1]\
151+
regexp -indices -- $WordBreakRE(previous) [string range [string range $str 0 $start] 0 end-1] \
152152
result word
153153
}
154154
return [lindex $word 0]

tests/word.test

+51-66
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# This file is a Tcl script to test the [tcl_startOf|endOf]* functions in
22
# word.tcl. It is organized in the standard fashion for Tcl tests.
33
#
4-
# Copyright (c) 2024 Jan Nijtmans
4+
# Copyright © 2024 Jan Nijtmans
55
# All rights reserved.
66

77
if {"::tcltest" ni [namespace children]} {
@@ -12,174 +12,159 @@ if {"::tcltest" ni [namespace children]} {
1212
::tcltest::loadTestedCommands
1313
catch [list package require -exact tcl::test [info patchlevel]]
1414

15-
test word-3.0 {tcl_endOfWord} -body {
15+
test word-1.0 {tcl_endOfWord} -body {
1616
tcl_endOfWord "ab cd" -1
1717
} -result 2
18-
test word-3.1 {tcl_endOfWord} -body {
18+
test word-1.1 {tcl_endOfWord} -body {
1919
tcl_endOfWord "ab cd" 0
2020
} -result 2
21-
test word-3.2 {tcl_endOfWord} -body {
21+
test word-1.2 {tcl_endOfWord} -body {
2222
tcl_endOfWord "ab cd" 1
2323
} -result 2
24-
test word-3.3 {tcl_endOfWord} -body {
24+
test word-1.3 {tcl_endOfWord} -body {
2525
tcl_endOfWord "ab cd" 2
2626
} -result -1
27-
test word-3.4 {tcl_endOfWord} -body {
27+
test word-1.4 {tcl_endOfWord} -body {
2828
tcl_endOfWord "ab cd" 3
2929
} -result -1
30-
test word-3.5 {tcl_endOfWord} -body {
30+
test word-1.5 {tcl_endOfWord} -body {
3131
tcl_endOfWord "ab cd" 4
3232
} -result -1
33-
test word-3.6 {tcl_endOfWord} -body {
33+
test word-1.6 {tcl_endOfWord} -body {
3434
tcl_endOfWord "ab cd" 5
3535
} -result -1
36-
test word-3.7 {tcl_endOfWord} -body {
36+
test word-1.7 {tcl_endOfWord} -body {
3737
tcl_endOfWord "ab cd" end
3838
} -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 {
4340
tcl_endOfWord "ab cd" end-1
4441
} -result -1
4542

46-
test word-4.0 {tcl_startOfPreviousWord} -body {
43+
test word-2.0 {tcl_startOfPreviousWord} -body {
4744
tcl_startOfPreviousWord "ab cd" -1
4845
} -result -1
49-
test word-4.1 {tcl_startOfPreviousWord} -body {
46+
test word-2.1 {tcl_startOfPreviousWord} -body {
5047
tcl_startOfPreviousWord "ab cd" 0
5148
} -result -1
52-
test word-4.2 {tcl_startOfPreviousWord} -body {
49+
test word-2.2 {tcl_startOfPreviousWord} -body {
5350
tcl_startOfPreviousWord "ab cd" 1
5451
} -result 0
55-
test word-4.3 {tcl_startOfPreviousWord} -body {
52+
test word-2.3 {tcl_startOfPreviousWord} -body {
5653
tcl_startOfPreviousWord "ab cd" 2
5754
} -result 0
58-
test word-4.4 {tcl_startOfPreviousWord} -body {
55+
test word-2.4 {tcl_startOfPreviousWord} -body {
5956
tcl_startOfPreviousWord "ab cd" 3
6057
} -result 0
61-
test word-4.5 {tcl_startOfPreviousWord} -body {
58+
test word-2.5 {tcl_startOfPreviousWord} -body {
6259
tcl_startOfPreviousWord "ab cd" 4
6360
} -result 3
64-
test word-4.6 {tcl_startOfPreviousWord} -body {
61+
test word-2.6 {tcl_startOfPreviousWord} -body {
6562
tcl_startOfPreviousWord "ab cd" 5
6663
} -result 3
67-
test word-4.7 {tcl_startOfPreviousWord} -body {
64+
test word-2.7 {tcl_startOfPreviousWord} -body {
6865
tcl_startOfPreviousWord "ab cd" end
6966
} -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 {
7468
tcl_startOfPreviousWord "ab cd" end-1
7569
} -result 0
7670

77-
test word-5.0 {tcl_startOfNextWord} -body {
71+
test word-3.0 {tcl_startOfNextWord} -body {
7872
tcl_startOfNextWord "ab cd" -1
7973
} -result 3
80-
test word-5.1 {tcl_startOfNextWord} -body {
74+
test word-3.1 {tcl_startOfNextWord} -body {
8175
tcl_startOfNextWord "ab cd" 0
8276
} -result 3
83-
test word-5.2 {tcl_startOfNextWord} -body {
77+
test word-3.2 {tcl_startOfNextWord} -body {
8478
tcl_startOfNextWord "ab cd" 1
8579
} -result 3
86-
test word-5.3 {tcl_startOfNextWord} -body {
80+
test word-3.3 {tcl_startOfNextWord} -body {
8781
tcl_startOfNextWord "ab cd" 2
8882
} -result 3
89-
test word-5.4 {tcl_startOfNextWord} -body {
83+
test word-3.4 {tcl_startOfNextWord} -body {
9084
tcl_startOfNextWord "ab cd" 3
9185
} -result -1
92-
test word-5.5 {tcl_startOfNextWord} -body {
86+
test word-3.5 {tcl_startOfNextWord} -body {
9387
tcl_startOfNextWord "ab cd" 4
9488
} -result -1
95-
test word-5.6 {tcl_startOfNextWord} -body {
89+
test word-3.6 {tcl_startOfNextWord} -body {
9690
tcl_startOfNextWord "ab cd" 5
9791
} -result -1
98-
test word-5.7 {tcl_startOfNextWord} -body {
92+
test word-3.7 {tcl_startOfNextWord} -body {
9993
tcl_startOfNextWord "ab cd" end
10094
} -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 {
10596
tcl_startOfNextWord "ab cd" end-1
10697
} -result -1
10798

108-
test word-6.0 {tcl_wordBreakBefore} -body {
99+
test word-4.0 {tcl_wordBreakBefore} -body {
109100
tcl_wordBreakBefore "ab cd" -1
110101
} -result -1
111-
test word-6.1 {tcl_wordBreakBefore} -body {
102+
test word-4.1 {tcl_wordBreakBefore} -body {
112103
tcl_wordBreakBefore "ab cd" 0
113104
} -result -1
114-
test word-6.2 {tcl_wordBreakBefore} -body {
105+
test word-4.2 {tcl_wordBreakBefore} -body {
115106
tcl_wordBreakBefore "ab cd" 1
116107
} -result -1
117-
test word-6.3 {tcl_wordBreakBefore} -body {
108+
test word-4.3 {tcl_wordBreakBefore} -body {
118109
tcl_wordBreakBefore "ab cd" 2
119110
} -result 2
120-
test word-6.4 {tcl_wordBreakBefore} -body {
111+
test word-4.4 {tcl_wordBreakBefore} -body {
121112
tcl_wordBreakBefore "ab cd" 3
122113
} -result 3
123-
test word-6.5 {tcl_wordBreakBefore} -body {
114+
test word-4.5 {tcl_wordBreakBefore} -body {
124115
tcl_wordBreakBefore "ab cd" 4
125116
} -result 3
126-
test word-6.6 {tcl_wordBreakBefore} -body {
117+
test word-4.6 {tcl_wordBreakBefore} -body {
127118
tcl_wordBreakBefore "ab cd" 5
128119
} -result 3
129-
test word-6.7 {tcl_wordBreakBefore} -body {
120+
test word-4.7 {tcl_wordBreakBefore} -body {
130121
tcl_wordBreakBefore "ab cd" end
131122
} -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 {
136124
tcl_startOfNextWord "ab cd" end-1
137125
} -result -1
138126

139-
test word-7.0 {tcl_wordBreakAfter} -body {
127+
test word-5.0 {tcl_wordBreakAfter} -body {
140128
tcl_wordBreakAfter "ab cd" -1
141129
} -result 2
142-
test word-7.1 {tcl_wordBreakAfter} -body {
130+
test word-5.1 {tcl_wordBreakAfter} -body {
143131
tcl_wordBreakAfter "ab cd" 0
144132
} -result 2
145-
test word-7.2 {tcl_wordBreakAfter} -body {
133+
test word-5.2 {tcl_wordBreakAfter} -body {
146134
tcl_wordBreakAfter "ab cd" 1
147135
} -result 2
148-
test word-7.3 {tcl_wordBreakAfter} -body {
136+
test word-5.3 {tcl_wordBreakAfter} -body {
149137
tcl_wordBreakAfter "ab cd" 2
150138
} -result 3
151-
test word-7.4 {tcl_wordBreakAfter} -body {
139+
test word-5.4 {tcl_wordBreakAfter} -body {
152140
tcl_wordBreakAfter "ab cd" 3
153141
} -result -1
154-
test word-7.5 {tcl_wordBreakAfter} -body {
142+
test word-5.5 {tcl_wordBreakAfter} -body {
155143
tcl_wordBreakAfter "ab cd" 4
156144
} -result -1
157-
test word-7.6 {tcl_wordBreakAfter} -body {
145+
test word-5.6 {tcl_wordBreakAfter} -body {
158146
tcl_wordBreakAfter "ab cd" 5
159147
} -result -1
160-
test word-7.7 {tcl_wordBreakAfter} -body {
148+
test word-5.7 {tcl_wordBreakAfter} -body {
161149
tcl_wordBreakAfter "ab cd" end
162150
} -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 {
167152
tcl_wordBreakAfter "ab cd" end-1
168153
} -result -1
169154

170-
test word-8.2 {tcl_startOfPreviousWord} -body {
155+
test word-6.0 {tcl_startOfPreviousWord} -body {
171156
tcl_startOfPreviousWord a b c d
172157
} -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 {
174159
tcl_startOfNextWord a b c d
175160
} -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 {
177162
tcl_endOfWord a b c d
178163
} -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 {
180165
tcl_wordBreakBefore a b c d
181166
} -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 {
183168
tcl_wordBreakAfter a b c d
184169
} -returnCodes 1 -result {wrong # args: should be "tcl_wordBreakAfter str start"}
185170

0 commit comments

Comments
 (0)