|
1
|
# |
|
2
|
# Copyright (c) 2011 D. Richard Hipp |
|
3
|
# |
|
4
|
# This program is free software; you can redistribute it and/or |
|
5
|
# modify it under the terms of the Simplified BSD License (also |
|
6
|
# known as the "2-Clause License" or "FreeBSD License".) |
|
7
|
# |
|
8
|
# This program is distributed in the hope that it will be useful, |
|
9
|
# but without any warranty; without even the implied warranty of |
|
10
|
# merchantability or fitness for a particular purpose. |
|
11
|
# |
|
12
|
# Author contact information: |
|
13
|
# [email protected] |
|
14
|
# http://www.hwaci.com/drh/ |
|
15
|
# |
|
16
|
############################################################################ |
|
17
|
# |
|
18
|
# TH1 Commands |
|
19
|
# |
|
20
|
|
|
21
|
set path [file dirname [info script]]; test_setup |
|
22
|
|
|
23
|
############################################################################### |
|
24
|
|
|
25
|
set th1Tcl [is_tcl_usable_by_fossil] |
|
26
|
set th1Hooks [are_th1_hooks_usable_by_fossil] |
|
27
|
|
|
28
|
############################################################################### |
|
29
|
|
|
30
|
fossil test-th-eval --open-config "setting abc" |
|
31
|
test th1-setting-1 {$RESULT eq ""} |
|
32
|
|
|
33
|
############################################################################### |
|
34
|
|
|
35
|
fossil test-th-eval --open-config "setting -- abc" |
|
36
|
test th1-setting-2 {$RESULT eq ""} |
|
37
|
|
|
38
|
############################################################################### |
|
39
|
|
|
40
|
fossil test-th-eval --open-config "setting -strict abc" |
|
41
|
test th1-setting-3 {$RESULT eq {TH_ERROR: no value for setting "abc"}} |
|
42
|
|
|
43
|
############################################################################### |
|
44
|
|
|
45
|
fossil test-th-eval --open-config "setting -strict -- abc" |
|
46
|
test th1-setting-4 {$RESULT eq {TH_ERROR: no value for setting "abc"}} |
|
47
|
|
|
48
|
############################################################################### |
|
49
|
|
|
50
|
fossil test-th-eval --open-config "setting autosync" |
|
51
|
test th1-setting-5 {$RESULT eq 0 || $RESULT eq 1 || $RESULT eq "on"} |
|
52
|
|
|
53
|
############################################################################### |
|
54
|
|
|
55
|
fossil test-th-eval --open-config "setting -strict autosync" |
|
56
|
test th1-setting-6 {$RESULT eq 0 || $RESULT eq 1 || $RESULT eq "on"} |
|
57
|
|
|
58
|
############################################################################### |
|
59
|
|
|
60
|
fossil test-th-eval --open-config "setting --" |
|
61
|
test th1-setting-7 {$RESULT eq \ |
|
62
|
{TH_ERROR: wrong # args: should be "setting ?-strict? ?--? name"}} |
|
63
|
|
|
64
|
############################################################################### |
|
65
|
|
|
66
|
fossil test-th-eval --open-config "setting -strict --" |
|
67
|
test th1-setting-8 {$RESULT eq \ |
|
68
|
{TH_ERROR: wrong # args: should be "setting ?-strict? ?--? name"}} |
|
69
|
|
|
70
|
############################################################################### |
|
71
|
|
|
72
|
fossil test-th-eval --open-config "setting -- --" |
|
73
|
test th1-setting-9 {$RESULT eq {}} |
|
74
|
|
|
75
|
############################################################################### |
|
76
|
|
|
77
|
fossil test-th-eval --open-config "setting -strict -- --" |
|
78
|
test th1-setting-10 {$RESULT eq {TH_ERROR: no value for setting "--"}} |
|
79
|
|
|
80
|
############################################################################### |
|
81
|
|
|
82
|
fossil test-th-eval "expr 42/0" |
|
83
|
test th1-divide-by-zero-1 {$RESULT eq {TH_ERROR: Divide by 0: 42}} |
|
84
|
|
|
85
|
############################################################################### |
|
86
|
|
|
87
|
fossil test-th-eval "expr 42/0.0" |
|
88
|
test th1-divide-by-zero-2 {$RESULT eq {TH_ERROR: Divide by 0: 42}} |
|
89
|
|
|
90
|
############################################################################### |
|
91
|
|
|
92
|
fossil test-th-eval "expr 42.0/0" |
|
93
|
test th1-divide-by-zero-3 {$RESULT eq {TH_ERROR: Divide by 0: 42.0}} |
|
94
|
|
|
95
|
############################################################################### |
|
96
|
|
|
97
|
fossil test-th-eval "expr 42.0/0.0" |
|
98
|
test th1-divide-by-zero-4 {$RESULT eq {TH_ERROR: Divide by 0: 42.0}} |
|
99
|
|
|
100
|
############################################################################### |
|
101
|
|
|
102
|
fossil test-th-eval "expr 42%0" |
|
103
|
test th1-modulus-by-zero-1 {$RESULT eq {TH_ERROR: Modulo by 0: 42}} |
|
104
|
|
|
105
|
############################################################################### |
|
106
|
|
|
107
|
fossil test-th-eval "expr 42%0.0" |
|
108
|
test th1-modulus-by-zero-2 {$RESULT eq {TH_ERROR: expected integer, got: "0.0"}} |
|
109
|
|
|
110
|
############################################################################### |
|
111
|
|
|
112
|
fossil test-th-eval "expr 42.0%0" |
|
113
|
test th1-modulus-by-zero-3 {$RESULT eq \ |
|
114
|
{TH_ERROR: expected integer, got: "42.0"}} |
|
115
|
|
|
116
|
############################################################################### |
|
117
|
|
|
118
|
fossil test-th-eval "expr 42.0%0.0" |
|
119
|
test th1-modulus-by-zero-4 {$RESULT eq \ |
|
120
|
{TH_ERROR: expected integer, got: "42.0"}} |
|
121
|
|
|
122
|
############################################################################### |
|
123
|
|
|
124
|
fossil test-th-eval "set var 1; info exists var" |
|
125
|
test th1-info-exists-1 {$RESULT eq {1}} |
|
126
|
|
|
127
|
############################################################################### |
|
128
|
|
|
129
|
fossil test-th-eval "set var 1; unset var; info exists var" |
|
130
|
test th1-info-exists-2 {$RESULT eq {0}} |
|
131
|
|
|
132
|
############################################################################### |
|
133
|
|
|
134
|
fossil test-th-eval "set var 1; unset var; set var 2; info exists var" |
|
135
|
test th1-info-exists-3 {$RESULT eq {1}} |
|
136
|
|
|
137
|
############################################################################### |
|
138
|
|
|
139
|
fossil test-th-eval "set var 1; expr {\$var+0}" |
|
140
|
test th1-info-exists-4 {$RESULT eq {1}} |
|
141
|
|
|
142
|
############################################################################### |
|
143
|
|
|
144
|
fossil test-th-eval "set var 1; unset var; expr {\$var+0}" |
|
145
|
test th1-info-exists-5 {$RESULT eq {TH_ERROR: no such variable: var}} |
|
146
|
|
|
147
|
############################################################################### |
|
148
|
|
|
149
|
fossil test-th-eval "catch {bad}; info exists var; set th_stack_trace" |
|
150
|
test th1-info-exists-6 {$RESULT eq {bad}} |
|
151
|
|
|
152
|
############################################################################### |
|
153
|
|
|
154
|
fossil test-th-eval "set var(1) 1; info exists var" |
|
155
|
test th1-info-exists-7 {$RESULT eq {1}} |
|
156
|
|
|
157
|
############################################################################### |
|
158
|
|
|
159
|
fossil test-th-eval "set var(1) 1; unset var(1); info exists var" |
|
160
|
test th1-info-exists-8 {$RESULT eq {1}} |
|
161
|
|
|
162
|
############################################################################### |
|
163
|
|
|
164
|
fossil test-th-eval "set var(1) 1; unset var; info exists var" |
|
165
|
test th1-info-exists-9 {$RESULT eq {0}} |
|
166
|
|
|
167
|
############################################################################### |
|
168
|
|
|
169
|
fossil test-th-eval "set var(1) 1; info exists var(1)" |
|
170
|
test th1-info-exists-10 {$RESULT eq {1}} |
|
171
|
|
|
172
|
############################################################################### |
|
173
|
|
|
174
|
fossil test-th-eval "set var(1) 1; unset var(1); info exists var(1)" |
|
175
|
test th1-info-exists-11 {$RESULT eq {0}} |
|
176
|
|
|
177
|
############################################################################### |
|
178
|
|
|
179
|
fossil test-th-eval "set var(1) 1; unset var; info exists var(1)" |
|
180
|
test th1-info-exists-12 {$RESULT eq {0}} |
|
181
|
|
|
182
|
############################################################################### |
|
183
|
|
|
184
|
fossil test-th-eval "set var 1; unset var" |
|
185
|
test th1-unset-1 {$RESULT eq {var}} |
|
186
|
|
|
187
|
############################################################################### |
|
188
|
|
|
189
|
fossil test-th-eval "unset var" |
|
190
|
test th1-unset-2 {$RESULT eq {TH_ERROR: no such variable: var}} |
|
191
|
|
|
192
|
############################################################################### |
|
193
|
|
|
194
|
fossil test-th-eval "set var 1; unset var; unset var" |
|
195
|
test th1-unset-3 {$RESULT eq {TH_ERROR: no such variable: var}} |
|
196
|
|
|
197
|
############################################################################### |
|
198
|
|
|
199
|
fossil test-th-eval "set gv 1; proc p {} {upvar 1 gv lv; unset lv}; p; unset gv" |
|
200
|
test th1-unset-4 {$RESULT eq {TH_ERROR: no such variable: gv}} |
|
201
|
|
|
202
|
############################################################################### |
|
203
|
|
|
204
|
fossil test-th-eval "set gv 1; upvar 0 gv gv2; info exists gv2" |
|
205
|
test th1-unset-5 {$RESULT eq {1}} |
|
206
|
|
|
207
|
############################################################################### |
|
208
|
|
|
209
|
fossil test-th-eval "set gv 1; upvar 0 gv gv2; unset gv; unset gv2" |
|
210
|
test th1-unset-6 {$RESULT eq {TH_ERROR: no such variable: gv2}} |
|
211
|
|
|
212
|
############################################################################### |
|
213
|
|
|
214
|
fossil test-th-eval "set gv 1; upvar 0 gv gv2(1); unset gv; unset gv2(1)" |
|
215
|
test th1-unset-7 {$RESULT eq {TH_ERROR: no such variable: gv2(1)}} |
|
216
|
|
|
217
|
############################################################################### |
|
218
|
|
|
219
|
fossil test-th-eval "set gv(1) 1; upvar 0 gv(1) gv2; unset gv(1); unset gv2" |
|
220
|
test th1-unset-8 {$RESULT eq {TH_ERROR: no such variable: gv2}} |
|
221
|
|
|
222
|
############################################################################### |
|
223
|
|
|
224
|
fossil test-th-eval "string first {} {}" |
|
225
|
test th1-string-first-1 {$RESULT eq {-1}} |
|
226
|
|
|
227
|
############################################################################### |
|
228
|
|
|
229
|
fossil test-th-eval "string first {} {a}" |
|
230
|
test th1-string-first-2 {$RESULT eq {-1}} |
|
231
|
|
|
232
|
############################################################################### |
|
233
|
|
|
234
|
fossil test-th-eval "string first {a} {}" |
|
235
|
test th1-string-first-3 {$RESULT eq {-1}} |
|
236
|
|
|
237
|
############################################################################### |
|
238
|
|
|
239
|
fossil test-th-eval "string first {a} {a}" |
|
240
|
test th1-string-first-4 {$RESULT eq {0}} |
|
241
|
|
|
242
|
############################################################################### |
|
243
|
|
|
244
|
fossil test-th-eval "string first {a} {aa}" |
|
245
|
test th1-string-first-5 {$RESULT eq {0}} |
|
246
|
|
|
247
|
############################################################################### |
|
248
|
|
|
249
|
fossil test-th-eval "string first {aa} {a}" |
|
250
|
test th1-string-first-6 {$RESULT eq {-1}} |
|
251
|
|
|
252
|
############################################################################### |
|
253
|
|
|
254
|
fossil test-th-eval "string first {ab} {abc}" |
|
255
|
test th1-string-first-7 {$RESULT eq {0}} |
|
256
|
|
|
257
|
############################################################################### |
|
258
|
|
|
259
|
fossil test-th-eval "string first {bc} {abc}" |
|
260
|
test th1-string-first-8 {$RESULT eq {1}} |
|
261
|
|
|
262
|
############################################################################### |
|
263
|
|
|
264
|
fossil test-th-eval "string first {AB} {abc}" |
|
265
|
test th1-string-first-9 {$RESULT eq {-1}} |
|
266
|
|
|
267
|
############################################################################### |
|
268
|
|
|
269
|
fossil test-th-eval "string last {} {}" |
|
270
|
test th1-string-last-1 {$RESULT eq {-1}} |
|
271
|
|
|
272
|
############################################################################### |
|
273
|
|
|
274
|
fossil test-th-eval "string last {} {a}" |
|
275
|
test th1-string-last-2 {$RESULT eq {-1}} |
|
276
|
|
|
277
|
############################################################################### |
|
278
|
|
|
279
|
fossil test-th-eval "string last {a} {}" |
|
280
|
test th1-string-last-3 {$RESULT eq {-1}} |
|
281
|
|
|
282
|
############################################################################### |
|
283
|
|
|
284
|
fossil test-th-eval "string last {a} {a}" |
|
285
|
test th1-string-last-4 {$RESULT eq {0}} |
|
286
|
|
|
287
|
############################################################################### |
|
288
|
|
|
289
|
fossil test-th-eval "string last {a} {aa}" |
|
290
|
test th1-string-last-5 {$RESULT eq {1}} |
|
291
|
|
|
292
|
############################################################################### |
|
293
|
|
|
294
|
fossil test-th-eval "string last {aa} {a}" |
|
295
|
test th1-string-last-6 {$RESULT eq {-1}} |
|
296
|
|
|
297
|
############################################################################### |
|
298
|
|
|
299
|
fossil test-th-eval "string last {ab} {abc}" |
|
300
|
test th1-string-last-7 {$RESULT eq {0}} |
|
301
|
|
|
302
|
############################################################################### |
|
303
|
|
|
304
|
fossil test-th-eval "string last {bc} {abc}" |
|
305
|
test th1-string-last-8 {$RESULT eq {1}} |
|
306
|
|
|
307
|
############################################################################### |
|
308
|
|
|
309
|
fossil test-th-eval "string last {AB} {abc}" |
|
310
|
test th1-string-last-9 {$RESULT eq {-1}} |
|
311
|
|
|
312
|
############################################################################### |
|
313
|
|
|
314
|
fossil test-th-eval "expr -2147483649.0" |
|
315
|
test th1-expr-1 {$RESULT eq {-2147483649.0}} |
|
316
|
|
|
317
|
############################################################################### |
|
318
|
|
|
319
|
fossil test-th-eval "expr -2147483649" |
|
320
|
test th1-expr-2 {$RESULT eq {2147483647}} |
|
321
|
|
|
322
|
############################################################################### |
|
323
|
|
|
324
|
fossil test-th-eval "expr -2147483648" |
|
325
|
test th1-expr-3 {$RESULT eq {-2147483648}} |
|
326
|
|
|
327
|
############################################################################### |
|
328
|
|
|
329
|
fossil test-th-eval "expr -2147483647" |
|
330
|
test th1-expr-4 {$RESULT eq {-2147483647}} |
|
331
|
|
|
332
|
############################################################################### |
|
333
|
|
|
334
|
fossil test-th-eval "expr -1" |
|
335
|
test th1-expr-5 {$RESULT eq {-1}} |
|
336
|
|
|
337
|
############################################################################### |
|
338
|
|
|
339
|
fossil test-th-eval "expr 0" |
|
340
|
test th1-expr-6 {$RESULT eq {0}} |
|
341
|
|
|
342
|
############################################################################### |
|
343
|
|
|
344
|
fossil test-th-eval "expr 0.0" |
|
345
|
test th1-expr-7 {$RESULT eq {0.0}} |
|
346
|
|
|
347
|
############################################################################### |
|
348
|
|
|
349
|
fossil test-th-eval "expr 1" |
|
350
|
test th1-expr-8 {$RESULT eq {1}} |
|
351
|
|
|
352
|
############################################################################### |
|
353
|
|
|
354
|
fossil test-th-eval "expr 2147483647" |
|
355
|
test th1-expr-9 {$RESULT eq {2147483647}} |
|
356
|
|
|
357
|
############################################################################### |
|
358
|
|
|
359
|
fossil test-th-eval "expr 2147483648" |
|
360
|
test th1-expr-10 {$RESULT eq {2147483648}} |
|
361
|
|
|
362
|
############################################################################### |
|
363
|
|
|
364
|
fossil test-th-eval "expr 2147483649" |
|
365
|
test th1-expr-11 {$RESULT eq {2147483649}} |
|
366
|
|
|
367
|
############################################################################### |
|
368
|
|
|
369
|
fossil test-th-eval "expr +2147483649" |
|
370
|
test th1-expr-12 {$RESULT eq {-2147483647}} |
|
371
|
|
|
372
|
############################################################################### |
|
373
|
|
|
374
|
fossil test-th-eval "expr +2147483649.0" |
|
375
|
test th1-expr-13 {$RESULT eq {2147483649.0}} |
|
376
|
|
|
377
|
############################################################################### |
|
378
|
|
|
379
|
fossil test-th-eval "expr ~(-1)" |
|
380
|
test th1-expr-14 {$RESULT eq {0}} |
|
381
|
|
|
382
|
############################################################################### |
|
383
|
|
|
384
|
fossil test-th-eval "expr ~-1" |
|
385
|
test th1-expr-15 {$RESULT eq {0}} |
|
386
|
|
|
387
|
############################################################################### |
|
388
|
|
|
389
|
fossil test-th-eval "expr ~0" |
|
390
|
test th1-expr-16 {$RESULT eq {-1}} |
|
391
|
|
|
392
|
############################################################################### |
|
393
|
|
|
394
|
fossil test-th-eval "expr ~+0" |
|
395
|
test th1-expr-17 {$RESULT eq {-1}} |
|
396
|
|
|
397
|
############################################################################### |
|
398
|
|
|
399
|
fossil test-th-eval "expr ~-0" |
|
400
|
test th1-expr-18 {$RESULT eq {-1}} |
|
401
|
|
|
402
|
############################################################################### |
|
403
|
|
|
404
|
fossil test-th-eval "expr ~(+0)" |
|
405
|
test th1-expr-19 {$RESULT eq {-1}} |
|
406
|
|
|
407
|
############################################################################### |
|
408
|
|
|
409
|
fossil test-th-eval "expr ~(-0)" |
|
410
|
test th1-expr-20 {$RESULT eq {-1}} |
|
411
|
|
|
412
|
############################################################################### |
|
413
|
|
|
414
|
fossil test-th-eval "expr ~1" |
|
415
|
test th1-expr-21 {$RESULT eq {-2}} |
|
416
|
|
|
417
|
############################################################################### |
|
418
|
|
|
419
|
fossil test-th-eval "expr ~+1" |
|
420
|
test th1-expr-22 {$RESULT eq {-2}} |
|
421
|
|
|
422
|
############################################################################### |
|
423
|
|
|
424
|
fossil test-th-eval "expr ~(+1)" |
|
425
|
test th1-expr-23 {$RESULT eq {-2}} |
|
426
|
|
|
427
|
############################################################################### |
|
428
|
|
|
429
|
fossil test-th-eval "expr 0+0b11" |
|
430
|
test th1-expr-24 {$RESULT eq 3} |
|
431
|
|
|
432
|
############################################################################### |
|
433
|
|
|
434
|
fossil test-th-eval "expr 0+0o15" |
|
435
|
test th1-expr-25 {$RESULT eq 13} |
|
436
|
|
|
437
|
############################################################################### |
|
438
|
|
|
439
|
fossil test-th-eval "expr 0+0x15" |
|
440
|
test th1-expr-26 {$RESULT eq 21} |
|
441
|
|
|
442
|
############################################################################### |
|
443
|
|
|
444
|
fossil test-th-eval "expr 0+0b2" |
|
445
|
test th1-expr-27 {$RESULT eq {TH_ERROR: expected number, got: "0b2"}} |
|
446
|
|
|
447
|
############################################################################### |
|
448
|
|
|
449
|
fossil test-th-eval "expr 0+0o8" |
|
450
|
test th1-expr-28 {$RESULT eq {TH_ERROR: expected number, got: "0o8"}} |
|
451
|
|
|
452
|
############################################################################### |
|
453
|
|
|
454
|
fossil test-th-eval "expr 0+0xg" |
|
455
|
test th1-expr-29 {$RESULT eq {TH_ERROR: syntax error in expression: "0+0xg"}} |
|
456
|
|
|
457
|
############################################################################### |
|
458
|
|
|
459
|
fossil test-th-eval "expr 0+0b1." |
|
460
|
test th1-expr-30 {$RESULT eq {TH_ERROR: syntax error in expression: "0+0b1."}} |
|
461
|
|
|
462
|
############################################################################### |
|
463
|
|
|
464
|
fossil test-th-eval "expr 0+0o1." |
|
465
|
test th1-expr-31 {$RESULT eq {TH_ERROR: syntax error in expression: "0+0o1."}} |
|
466
|
|
|
467
|
############################################################################### |
|
468
|
|
|
469
|
fossil test-th-eval "expr 0+0x1." |
|
470
|
test th1-expr-32 {$RESULT eq {TH_ERROR: syntax error in expression: "0+0x1."}} |
|
471
|
|
|
472
|
############################################################################### |
|
473
|
|
|
474
|
fossil test-th-eval "expr 0ne5" |
|
475
|
test th1-expr-33 {$RESULT eq {1}} |
|
476
|
|
|
477
|
############################################################################### |
|
478
|
|
|
479
|
fossil test-th-eval "expr 0b1+5" |
|
480
|
test th1-expr-34 {$RESULT eq {6}} |
|
481
|
|
|
482
|
############################################################################### |
|
483
|
|
|
484
|
fossil test-th-eval "expr 0+0b" |
|
485
|
test th1-expr-35 {$RESULT eq {TH_ERROR: expected number, got: "0b"}} |
|
486
|
|
|
487
|
############################################################################### |
|
488
|
|
|
489
|
fossil test-th-eval "expr (-1)+1" |
|
490
|
test th1-expr-36 {$RESULT eq {0}} |
|
491
|
|
|
492
|
############################################################################### |
|
493
|
|
|
494
|
fossil test-th-eval "expr (((-1)))" |
|
495
|
test th1-expr-37 {$RESULT eq {-1}} |
|
496
|
|
|
497
|
############################################################################### |
|
498
|
|
|
499
|
fossil test-th-eval "expr (((1)))" |
|
500
|
test th1-expr-38 {$RESULT eq {1}} |
|
501
|
|
|
502
|
############################################################################### |
|
503
|
|
|
504
|
fossil test-th-eval "expr (((1))" |
|
505
|
test th1-expr-39 {$RESULT eq {TH_ERROR: syntax error in expression: "(((1))"}} |
|
506
|
|
|
507
|
############################################################################### |
|
508
|
|
|
509
|
fossil test-th-eval "expr ((1)))" |
|
510
|
test th1-expr-40 {$RESULT eq {TH_ERROR: syntax error in expression: "((1)))"}} |
|
511
|
|
|
512
|
############################################################################### |
|
513
|
|
|
514
|
fossil test-th-eval "expr (((1)*2)*2)" |
|
515
|
test th1-expr-41 {$RESULT eq {4}} |
|
516
|
|
|
517
|
############################################################################### |
|
518
|
|
|
519
|
fossil test-th-eval "expr +" |
|
520
|
test th1-expr-42 {$RESULT eq {TH_ERROR: syntax error in expression: "+"}} |
|
521
|
|
|
522
|
############################################################################### |
|
523
|
|
|
524
|
fossil test-th-eval "expr -" |
|
525
|
test th1-expr-43 {$RESULT eq {TH_ERROR: syntax error in expression: "-"}} |
|
526
|
|
|
527
|
############################################################################### |
|
528
|
|
|
529
|
fossil test-th-eval "expr ++" |
|
530
|
test th1-expr-44 {$RESULT eq {TH_ERROR: syntax error in expression: "++"}} |
|
531
|
|
|
532
|
############################################################################### |
|
533
|
|
|
534
|
fossil test-th-eval "expr --" |
|
535
|
test th1-expr-45 {$RESULT eq {TH_ERROR: syntax error in expression: "--"}} |
|
536
|
|
|
537
|
############################################################################### |
|
538
|
|
|
539
|
fossil test-th-eval "lindex list +" |
|
540
|
test th1-expr-46 {$RESULT eq {TH_ERROR: expected integer, got: "+"}} |
|
541
|
|
|
542
|
############################################################################### |
|
543
|
|
|
544
|
fossil test-th-eval "lindex list -" |
|
545
|
test th1-expr-47 {$RESULT eq {TH_ERROR: expected integer, got: "-"}} |
|
546
|
|
|
547
|
############################################################################### |
|
548
|
|
|
549
|
fossil test-th-eval "lindex list +0x" |
|
550
|
test th1-expr-48 {$RESULT eq {TH_ERROR: expected integer, got: "+0x"}} |
|
551
|
|
|
552
|
############################################################################### |
|
553
|
|
|
554
|
fossil test-th-eval "lindex list -0x" |
|
555
|
test th1-expr-49 {$RESULT eq {TH_ERROR: expected integer, got: "-0x"}} |
|
556
|
|
|
557
|
############################################################################### |
|
558
|
|
|
559
|
set skip_anycap 1 |
|
560
|
if {$::outside_fossil_repo} { |
|
561
|
puts "Skipping th1-anycap-*-1 perm tests: not in Fossil repo checkout." |
|
562
|
} elseif ($::dirty_ckout) { |
|
563
|
puts "Skipping th1-anycap-*-1 perm tests: uncommitted changes in Fossil checkout." |
|
564
|
} else { |
|
565
|
set skip_anycap 0 |
|
566
|
} |
|
567
|
|
|
568
|
# NOTE: The 'd' permission is no longer used. |
|
569
|
foreach perm [list \ |
|
570
|
a b c e f g h i j k l m n o p q r s t u v w x y z \ |
|
571
|
A D \ |
|
572
|
2 3 4 5 6 7 ] { |
|
573
|
if {$perm eq "u"} continue; # NOTE: Skip "reader" meta-permission. |
|
574
|
if {$perm eq "v"} continue; # NOTE: Skip "developer" meta-permission. |
|
575
|
|
|
576
|
set ::env(TH1_TEST_USER_CAPS) sxy |
|
577
|
fossil test-th-eval "anycap $perm" |
|
578
|
test th1-anycap-no-$perm-1 {$RESULT eq {0}} |
|
579
|
|
|
580
|
fossil test-th-eval "hascap $perm" |
|
581
|
test th1-hascap-no-$perm-1 {$RESULT eq {0}} |
|
582
|
|
|
583
|
fossil test-th-eval "anoncap $perm" |
|
584
|
test th1-anoncap-no-$perm-1 {$RESULT eq {0}} |
|
585
|
|
|
586
|
if {$skip_anycap} { continue } |
|
587
|
|
|
588
|
run_in_checkout { |
|
589
|
set ::env(TH1_TEST_USER_CAPS) sxy |
|
590
|
fossil test-th-eval --set-user-caps "anycap $perm" |
|
591
|
test th1-anycap-yes-$perm-1 {$RESULT eq {1}} |
|
592
|
|
|
593
|
set ::env(TH1_TEST_USER_CAPS) 1; # NOTE: Bad permission. |
|
594
|
fossil test-th-eval --set-user-caps "anycap $perm" |
|
595
|
test th1-anycap-no-$perm-1 {$RESULT eq {0}} |
|
596
|
|
|
597
|
set ::env(TH1_TEST_USER_CAPS) sxy |
|
598
|
fossil test-th-eval --set-user-caps "hascap $perm" |
|
599
|
test th1-hascap-yes-$perm-1 {$RESULT eq {1}} |
|
600
|
|
|
601
|
set ::env(TH1_TEST_USER_CAPS) 1; # NOTE: Bad permission. |
|
602
|
fossil test-th-eval --set-user-caps "hascap $perm" |
|
603
|
test th1-hascap-no-$perm-1 {$RESULT eq {0}} |
|
604
|
unset ::env(TH1_TEST_USER_CAPS) |
|
605
|
|
|
606
|
set ::env(TH1_TEST_ANON_CAPS) sxy |
|
607
|
fossil test-th-eval --set-anon-caps "anoncap $perm" |
|
608
|
test th1-anoncap-yes-$perm-1 {$RESULT eq {1}} |
|
609
|
|
|
610
|
set ::env(TH1_TEST_ANON_CAPS) 1; # NOTE: Bad permission. |
|
611
|
fossil test-th-eval --set-anon-caps "anoncap $perm" |
|
612
|
test th1-anoncap-no-$perm-1 {$RESULT eq {0}} |
|
613
|
unset ::env(TH1_TEST_ANON_CAPS) |
|
614
|
} |
|
615
|
} |
|
616
|
|
|
617
|
############################################################################### |
|
618
|
|
|
619
|
fossil test-th-eval "anycap oh" |
|
620
|
test th1-anycap-no-multiple-1 {$RESULT eq {0}} |
|
621
|
|
|
622
|
############################################################################### |
|
623
|
|
|
624
|
fossil test-th-eval "hascap oh" |
|
625
|
test th1-hascap-no-multiple-1 {$RESULT eq {0}} |
|
626
|
|
|
627
|
############################################################################### |
|
628
|
|
|
629
|
fossil test-th-eval "hascap o h" |
|
630
|
test th1-hascap-no-multiple-2 {$RESULT eq {0}} |
|
631
|
|
|
632
|
############################################################################### |
|
633
|
|
|
634
|
fossil test-th-eval "anoncap oh" |
|
635
|
test th1-anoncap-no-multiple-1 {$RESULT eq {0}} |
|
636
|
|
|
637
|
############################################################################### |
|
638
|
|
|
639
|
fossil test-th-eval "anoncap o h" |
|
640
|
test th1-anoncap-no-multiple-2 {$RESULT eq {0}} |
|
641
|
|
|
642
|
############################################################################### |
|
643
|
|
|
644
|
test_block_in_checkout "test-anoncap-*" { |
|
645
|
fossil test-th-eval --set-user-caps "anycap oh" |
|
646
|
test th1-anycap-yes-multiple-1 {$RESULT eq {1}} |
|
647
|
|
|
648
|
set ::env(TH1_TEST_USER_CAPS) o |
|
649
|
fossil test-th-eval --set-user-caps "anycap oh" |
|
650
|
test th1-anycap-yes-multiple-2 {$RESULT eq {1}} |
|
651
|
unset ::env(TH1_TEST_USER_CAPS) |
|
652
|
|
|
653
|
fossil test-th-eval --set-user-caps "hascap oh" |
|
654
|
test th1-hascap-yes-multiple-1 {$RESULT eq {1}} |
|
655
|
|
|
656
|
set ::env(TH1_TEST_USER_CAPS) o |
|
657
|
fossil test-th-eval --set-user-caps "hascap oh" |
|
658
|
test th1-hascap-no-multiple-3 {$RESULT eq {0}} |
|
659
|
unset ::env(TH1_TEST_USER_CAPS) |
|
660
|
|
|
661
|
fossil test-th-eval --set-user-caps "hascap o h" |
|
662
|
test th1-hascap-yes-multiple-2 {$RESULT eq {1}} |
|
663
|
|
|
664
|
set ::env(TH1_TEST_USER_CAPS) o |
|
665
|
fossil test-th-eval --set-user-caps "hascap o h" |
|
666
|
test th1-hascap-no-multiple-4 {$RESULT eq {0}} |
|
667
|
unset ::env(TH1_TEST_USER_CAPS) |
|
668
|
|
|
669
|
fossil test-th-eval --set-anon-caps "anoncap oh" |
|
670
|
test th1-anoncap-yes-multiple-1 {$RESULT eq {1}} |
|
671
|
|
|
672
|
set ::env(TH1_TEST_ANON_CAPS) o |
|
673
|
fossil test-th-eval --set-anon-caps "anoncap oh" |
|
674
|
test th1-anoncap-no-multiple-3 {$RESULT eq {0}} |
|
675
|
unset ::env(TH1_TEST_ANON_CAPS) |
|
676
|
|
|
677
|
fossil test-th-eval --set-anon-caps "anoncap o h" |
|
678
|
test th1-anoncap-yes-multiple-2 {$RESULT eq {1}} |
|
679
|
|
|
680
|
set ::env(TH1_TEST_ANON_CAPS) o |
|
681
|
fossil test-th-eval --set-anon-caps "anoncap o h" |
|
682
|
test th1-anoncap-no-multiple-4 {$RESULT eq {0}} |
|
683
|
unset ::env(TH1_TEST_ANON_CAPS) |
|
684
|
} |
|
685
|
|
|
686
|
############################################################################### |
|
687
|
|
|
688
|
test_in_checkout th1-checkout-1 { |
|
689
|
# NOTE: The "1" here forces the checkout to be opened. |
|
690
|
fossil test-th-eval "checkout 1" |
|
691
|
} {[string length $RESULT] > 0} |
|
692
|
|
|
693
|
############################################################################### |
|
694
|
|
|
695
|
test_in_checkout th1-checkout-2 { |
|
696
|
if {$th1Hooks} { |
|
697
|
fossil test-th-eval "checkout" |
|
698
|
} else { |
|
699
|
# NOTE: No TH1 hooks, force checkout to be populated. |
|
700
|
fossil test-th-eval --open-config "checkout" |
|
701
|
} |
|
702
|
} {[string length $RESULT] > 0} |
|
703
|
|
|
704
|
############################################################################### |
|
705
|
|
|
706
|
set savedPwd [pwd]; cd / |
|
707
|
fossil test-th-eval "checkout 1" |
|
708
|
cd $savedPwd; unset savedPwd |
|
709
|
test th1-checkout-3 {[string length $RESULT] == 0} |
|
710
|
|
|
711
|
############################################################################### |
|
712
|
|
|
713
|
set savedPwd [pwd]; cd / |
|
714
|
fossil test-th-eval "checkout" |
|
715
|
cd $savedPwd; unset savedPwd |
|
716
|
test th1-checkout-4 {[string length $RESULT] == 0} |
|
717
|
|
|
718
|
############################################################################### |
|
719
|
|
|
720
|
fossil test-th-eval "render {}" |
|
721
|
test th1-render-1 {$RESULT eq {}} |
|
722
|
|
|
723
|
############################################################################### |
|
724
|
|
|
725
|
fossil test-th-eval "render {$<x> before <th1>set x 123</th1> after $<x> }" |
|
726
|
test th1-render-2 {$RESULT eq {no such variable: x before after 123 }} |
|
727
|
|
|
728
|
############################################################################### |
|
729
|
|
|
730
|
fossil test-th-eval "trace {}" |
|
731
|
test th1-trace-1 {$RESULT eq {}} |
|
732
|
|
|
733
|
############################################################################### |
|
734
|
|
|
735
|
fossil test-th-eval --th-trace "trace {}" -expectError |
|
736
|
set normalized_result [normalize_result] |
|
737
|
|
|
738
|
regsub -- {\n/\*\*\*\*\* Subprocess \d+ exit\(\d+\) \*\*\*\*\*/} \ |
|
739
|
$normalized_result {} normalized_result |
|
740
|
|
|
741
|
if {$th1Hooks} { |
|
742
|
test th1-trace-2 {$normalized_result eq \ |
|
743
|
{------------------ BEGIN TRACE LOG ------------------ |
|
744
|
th1-init 0x0 => 0x0<br> |
|
745
|
|
|
746
|
------------------- END TRACE LOG -------------------}} |
|
747
|
} else { |
|
748
|
test th1-trace-2 {$normalized_result eq \ |
|
749
|
{------------------ BEGIN TRACE LOG ------------------ |
|
750
|
th1-init 0x0 => 0x0<br> |
|
751
|
th1-setup {} => TH_OK<br> |
|
752
|
|
|
753
|
------------------- END TRACE LOG -------------------}} |
|
754
|
} |
|
755
|
|
|
756
|
############################################################################### |
|
757
|
|
|
758
|
fossil test-th-eval "trace {this is a trace message.}" |
|
759
|
test th1-trace-3 {$RESULT eq {}} |
|
760
|
|
|
761
|
############################################################################### |
|
762
|
|
|
763
|
fossil test-th-eval --th-trace "trace {this is a trace message.}" -expectError |
|
764
|
set normalized_result [normalize_result] |
|
765
|
|
|
766
|
regsub -- {\n/\*\*\*\*\* Subprocess \d+ exit\(\d+\) \*\*\*\*\*/} \ |
|
767
|
$normalized_result {} normalized_result |
|
768
|
|
|
769
|
if {$th1Hooks} { |
|
770
|
test th1-trace-4 {$normalized_result eq \ |
|
771
|
{------------------ BEGIN TRACE LOG ------------------ |
|
772
|
th1-init 0x0 => 0x0<br> |
|
773
|
this is a trace message. |
|
774
|
------------------- END TRACE LOG -------------------}} |
|
775
|
} else { |
|
776
|
test th1-trace-4 {$normalized_result eq \ |
|
777
|
{------------------ BEGIN TRACE LOG ------------------ |
|
778
|
th1-init 0x0 => 0x0<br> |
|
779
|
th1-setup {} => TH_OK<br> |
|
780
|
this is a trace message. |
|
781
|
------------------- END TRACE LOG -------------------}} |
|
782
|
} |
|
783
|
|
|
784
|
############################################################################### |
|
785
|
|
|
786
|
fossil test-th-eval "defHeader {Page Title Here}" |
|
787
|
test th1-defHeader-1 {$RESULT eq \ |
|
788
|
{TH_ERROR: wrong # args: should be "defHeader"}} |
|
789
|
|
|
790
|
############################################################################### |
|
791
|
|
|
792
|
fossil test-th-eval "defHeader" |
|
793
|
test th1-defHeader-2 {[string match *<body> [normalize_result]] || \ |
|
794
|
[string match "*<body class=\"\$current_feature\ |
|
795
|
rpage-\$requested_page\ |
|
796
|
cpage-\$canonical_page\">" [normalize_result]]} |
|
797
|
|
|
798
|
############################################################################### |
|
799
|
|
|
800
|
#fossil test-th-eval "styleHeader {Page Title Here}" |
|
801
|
#test th1-header-1 {$RESULT eq {TH_ERROR: repository unavailable}} |
|
802
|
|
|
803
|
############################################################################### |
|
804
|
|
|
805
|
test_in_checkout th1-header-2 { |
|
806
|
fossil test-th-eval --open-config "styleHeader {Page Title Here}" |
|
807
|
} {[regexp -- {<title>Fossil: Page Title Here</title>} $RESULT]} |
|
808
|
|
|
809
|
############################################################################### |
|
810
|
|
|
811
|
#fossil test-th-eval "styleFooter" |
|
812
|
#test th1-footer-1 {$RESULT eq {TH_ERROR: repository unavailable}} |
|
813
|
|
|
814
|
############################################################################### |
|
815
|
|
|
816
|
fossil test-th-eval --open-config "styleFooter" |
|
817
|
test th1-footer-2 {$RESULT eq {}} |
|
818
|
|
|
819
|
############################################################################### |
|
820
|
|
|
821
|
fossil test-th-eval --open-config --cgi "styleHeader {}; styleFooter" |
|
822
|
test th1-footer-3 {[regexp -- {</body>\n</html>} $RESULT]} |
|
823
|
|
|
824
|
############################################################################### |
|
825
|
|
|
826
|
fossil test-th-eval "getParameter" |
|
827
|
test th1-get-parameter-1 {$RESULT eq \ |
|
828
|
{TH_ERROR: wrong # args: should be "getParameter NAME ?DEFAULT?"}} |
|
829
|
|
|
830
|
############################################################################### |
|
831
|
|
|
832
|
fossil test-th-eval "getParameter test1" |
|
833
|
test th1-get-parameter-2 {$RESULT eq {}} |
|
834
|
|
|
835
|
############################################################################### |
|
836
|
|
|
837
|
fossil test-th-eval "getParameter test1 defValue1" |
|
838
|
test th1-get-parameter-3 {$RESULT eq {defValue1}} |
|
839
|
|
|
840
|
############################################################################### |
|
841
|
|
|
842
|
fossil test-th-eval "setParameter" |
|
843
|
test th1-set-parameter-1 {$RESULT eq \ |
|
844
|
{TH_ERROR: wrong # args: should be "setParameter NAME VALUE"}} |
|
845
|
|
|
846
|
############################################################################### |
|
847
|
|
|
848
|
fossil test-th-eval "setParameter test1 value1; getParameter test1" |
|
849
|
test th1-set-parameter-2 {$RESULT eq {value1}} |
|
850
|
|
|
851
|
############################################################################### |
|
852
|
|
|
853
|
fossil test-th-eval "setParameter test2 value2; getParameter test1" |
|
854
|
test th1-set-parameter-3 {$RESULT eq {}} |
|
855
|
|
|
856
|
############################################################################### |
|
857
|
|
|
858
|
fossil test-th-eval "setParameter test3 value3; getParameter test3" |
|
859
|
test th1-set-parameter-4 {$RESULT eq {value3}} |
|
860
|
|
|
861
|
############################################################################### |
|
862
|
|
|
863
|
fossil test-th-eval "setParameter test3 value3; getParameter test3 defValue3" |
|
864
|
test th1-set-parameter-5 {$RESULT eq {value3}} |
|
865
|
|
|
866
|
############################################################################### |
|
867
|
|
|
868
|
fossil test-th-eval "setParameter test4 value4; setParameter test4 value5; getParameter test4" |
|
869
|
test th1-set-parameter-6 {$RESULT eq {value5}} |
|
870
|
|
|
871
|
############################################################################### |
|
872
|
|
|
873
|
fossil test-th-eval "setParameter test4 value4; setParameter test4 value5; getParameter test4 defValue4" |
|
874
|
test th1-set-parameter-7 {$RESULT eq {value5}} |
|
875
|
|
|
876
|
############################################################################### |
|
877
|
|
|
878
|
fossil test-th-eval "artifact" |
|
879
|
test th1-artifact-1 {$RESULT eq \ |
|
880
|
{TH_ERROR: wrong # args: should be "artifact ID ?FILENAME?"}} |
|
881
|
|
|
882
|
############################################################################### |
|
883
|
|
|
884
|
#fossil test-th-eval "artifact tip" |
|
885
|
#test th1-artifact-2 {$RESULT eq {TH_ERROR: repository unavailable}} |
|
886
|
|
|
887
|
############################################################################### |
|
888
|
|
|
889
|
test_in_checkout th1-artifact-3 { |
|
890
|
fossil test-th-eval --open-config "artifact tip" |
|
891
|
} {[regexp -- {F test/th1\.test [0-9a-f]{40,64}} $RESULT]} |
|
892
|
|
|
893
|
############################################################################### |
|
894
|
|
|
895
|
#fossil test-th-eval "artifact 0000000000" |
|
896
|
#test th1-artifact-4 {$RESULT eq {TH_ERROR: repository unavailable}} |
|
897
|
|
|
898
|
############################################################################### |
|
899
|
|
|
900
|
fossil test-th-eval --open-config "artifact 0000000000" |
|
901
|
test th1-artifact-5 {$RESULT eq {TH_ERROR: name not found}} |
|
902
|
|
|
903
|
############################################################################### |
|
904
|
|
|
905
|
#fossil test-th-eval "artifact tip test/th1.test" |
|
906
|
#test th1-artifact-6 {$RESULT eq {TH_ERROR: repository unavailable}} |
|
907
|
|
|
908
|
############################################################################### |
|
909
|
|
|
910
|
test_in_checkout th1-artifact-7 { |
|
911
|
fossil test-th-eval --open-config "artifact tip test/th1.test" |
|
912
|
} {[regexp -- {th1-artifact-7} $RESULT]} |
|
913
|
|
|
914
|
############################################################################### |
|
915
|
|
|
916
|
#fossil test-th-eval "artifact 0000000000 test/th1.test" |
|
917
|
#test th1-artifact-8 {$RESULT eq {TH_ERROR: repository unavailable}} |
|
918
|
|
|
919
|
############################################################################### |
|
920
|
|
|
921
|
fossil test-th-eval --open-config "artifact 0000000000 test/th1.test" |
|
922
|
test th1-artifact-9 {$RESULT eq {TH_ERROR: manifest not found}} |
|
923
|
|
|
924
|
############################################################################### |
|
925
|
|
|
926
|
test_in_checkout th1-globalState-1 { |
|
927
|
if {$th1Hooks} { |
|
928
|
fossil test-th-eval "globalState checkout" |
|
929
|
} else { |
|
930
|
# NOTE: No TH1 hooks, force checkout to be populated. |
|
931
|
fossil test-th-eval --open-config "globalState checkout" |
|
932
|
} |
|
933
|
} {[string length $RESULT] > 0} |
|
934
|
|
|
935
|
############################################################################### |
|
936
|
|
|
937
|
test_block_in_checkout th1-globalState-2 { |
|
938
|
if {$th1Hooks} { |
|
939
|
fossil test-th-eval "globalState checkout" |
|
940
|
test th1-globalState-2 {$RESULT eq [fossil test-th-eval checkout]} |
|
941
|
} else { |
|
942
|
# NOTE: No TH1 hooks, force checkout to be populated. |
|
943
|
fossil test-th-eval --open-config "globalState checkout" |
|
944
|
|
|
945
|
test th1-globalState-2 {$RESULT eq \ |
|
946
|
[fossil test-th-eval --open-config checkout]} |
|
947
|
} |
|
948
|
} |
|
949
|
|
|
950
|
############################################################################### |
|
951
|
|
|
952
|
#fossil test-th-eval "globalState configuration" |
|
953
|
#test th1-globalState-3 {[string length $RESULT] == 0} |
|
954
|
|
|
955
|
############################################################################### |
|
956
|
|
|
957
|
fossil test-th-eval --open-config "globalState configuration" |
|
958
|
test th1-globalState-4 {[string length $RESULT] > 0} |
|
959
|
|
|
960
|
############################################################################### |
|
961
|
|
|
962
|
fossil test-th-eval "globalState executable" |
|
963
|
test th1-globalState-5 {[file rootname [file tail $RESULT]] eq "fossil"} |
|
964
|
|
|
965
|
############################################################################### |
|
966
|
|
|
967
|
fossil test-th-eval "globalState log" |
|
968
|
test th1-globalState-6 {[string length $RESULT] == 0} |
|
969
|
|
|
970
|
############################################################################### |
|
971
|
|
|
972
|
fossil test-th-eval --errorlog foserrors.log "globalState log" |
|
973
|
test th1-globalState-7 {$RESULT eq "foserrors.log"} |
|
974
|
|
|
975
|
############################################################################### |
|
976
|
|
|
977
|
test_in_checkout th1-globalState-8 { |
|
978
|
if {$th1Hooks} { |
|
979
|
fossil test-th-eval "globalState repository" |
|
980
|
} else { |
|
981
|
# NOTE: No TH1 hooks, force repository to be populated. |
|
982
|
fossil test-th-eval --open-config "globalState repository" |
|
983
|
} |
|
984
|
} {[string length $RESULT] > 0} |
|
985
|
|
|
986
|
############################################################################### |
|
987
|
|
|
988
|
test_block_in_checkout th1-globalState-9 { |
|
989
|
if {$th1Hooks} { |
|
990
|
fossil test-th-eval "globalState repository" |
|
991
|
test th1-globalState-9 {$RESULT eq [fossil test-th-eval repository]} |
|
992
|
} else { |
|
993
|
# NOTE: No TH1 hooks, force repository to be populated. |
|
994
|
fossil test-th-eval --open-config "globalState repository" |
|
995
|
|
|
996
|
test th1-globalState-9 {$RESULT eq \ |
|
997
|
[fossil test-th-eval --open-config repository]} |
|
998
|
} |
|
999
|
} |
|
1000
|
|
|
1001
|
############################################################################### |
|
1002
|
|
|
1003
|
fossil test-th-eval "globalState top" |
|
1004
|
test th1-globalState-10 {[string length $RESULT] == 0} |
|
1005
|
|
|
1006
|
############################################################################### |
|
1007
|
|
|
1008
|
fossil test-th-eval "globalState user" |
|
1009
|
test th1-globalState-11 {[string length $RESULT] == 0} |
|
1010
|
|
|
1011
|
############################################################################### |
|
1012
|
|
|
1013
|
fossil test-th-eval --user fossil-th1-test "globalState user" |
|
1014
|
test th1-globalState-12 {$RESULT eq "fossil-th1-test"} |
|
1015
|
|
|
1016
|
############################################################################### |
|
1017
|
|
|
1018
|
fossil test-th-eval "globalState vfs" |
|
1019
|
test th1-globalState-13 {[string length $RESULT] == 0} |
|
1020
|
|
|
1021
|
############################################################################### |
|
1022
|
|
|
1023
|
fossil test-th-eval "globalState vfs" |
|
1024
|
test th1-globalState-14 {[string length $RESULT] == 0} |
|
1025
|
|
|
1026
|
############################################################################### |
|
1027
|
|
|
1028
|
if {$is_windows || $is_cygwin} { |
|
1029
|
set altVfs win32-longpath |
|
1030
|
} else { |
|
1031
|
set altVfs unix-dotfile |
|
1032
|
} |
|
1033
|
|
|
1034
|
############################################################################### |
|
1035
|
|
|
1036
|
fossil test-th-eval --vfs $altVfs "globalState vfs" |
|
1037
|
test th1-globalState-15 {$RESULT eq $altVfs} |
|
1038
|
|
|
1039
|
############################################################################### |
|
1040
|
|
|
1041
|
fossil test-th-eval "globalState flags" |
|
1042
|
test th1-globalState-16 {$RESULT eq "0"} |
|
1043
|
|
|
1044
|
############################################################################### |
|
1045
|
|
|
1046
|
#fossil test-th-eval "reinitialize; globalState configuration" |
|
1047
|
#test th1-reinitialize-1 {$RESULT eq ""} |
|
1048
|
|
|
1049
|
############################################################################### |
|
1050
|
|
|
1051
|
fossil test-th-eval "reinitialize 1; globalState configuration" |
|
1052
|
test th1-reinitialize-2 {$RESULT ne ""} |
|
1053
|
|
|
1054
|
############################################################################### |
|
1055
|
|
|
1056
|
# |
|
1057
|
# NOTE: This test will fail if the command names are added to TH1, or |
|
1058
|
# moved from Tcl builds to plain or the reverse. Sorting the |
|
1059
|
# command lists eliminates a dependence on order. |
|
1060
|
# |
|
1061
|
#fossil test-th-eval "info commands" |
|
1062
|
#set sorted_result [lsort $RESULT] |
|
1063
|
#protOut "Sorted: $sorted_result" |
|
1064
|
#set base_commands {anoncap anycap array artifact break breakpoint \ |
|
1065
|
# builtin_request_js capexpr captureTh1 catch cgiHeaderLine checkout \ |
|
1066
|
# combobox continue copybtn date decorate defHeader dir \ |
|
1067
|
# enable_output encode64 error expr for foreach getParameter glob_match \ |
|
1068
|
# globalState hascap hasfeature html htmlize http httpize if info \ |
|
1069
|
# insertCsrf lappend lindex linecount list llength lsearch markdown nonce \ |
|
1070
|
# proc puts query randhex redirect regexp reinitialize rename render \ |
|
1071
|
# repository return searchable set setParameter setting stime string \ |
|
1072
|
# styleFooter styleHeader styleScript submenu tclReady trace unset \ |
|
1073
|
# unversioned uplevel upvar utime verifyCsrf verifyLogin wiki} |
|
1074
|
#set tcl_commands {tclEval tclExpr tclInvoke tclIsSafe tclMakeSafe} |
|
1075
|
#if {$th1Tcl} { |
|
1076
|
# test th1-info-commands-1 {$sorted_result eq [lsort "$base_commands $tcl_commands"]} |
|
1077
|
#} else { |
|
1078
|
# test th1-info-commands-1 {$sorted_result eq [lsort "$base_commands"]} |
|
1079
|
#} |
|
1080
|
|
|
1081
|
############################################################################### |
|
1082
|
|
|
1083
|
fossil test-th-eval "info vars" |
|
1084
|
|
|
1085
|
if {$th1Hooks} { |
|
1086
|
test th1-info-vars-1 {[lsort $RESULT] eq \ |
|
1087
|
[lsort "th_stack_trace cmd_flags tcl_platform cmd_name cmd_args"]} |
|
1088
|
} else { |
|
1089
|
test th1-info-vars-1 {$RESULT eq "tcl_platform"} |
|
1090
|
} |
|
1091
|
|
|
1092
|
############################################################################### |
|
1093
|
|
|
1094
|
fossil test-th-eval "set x 1; info vars" |
|
1095
|
|
|
1096
|
if {$th1Hooks} { |
|
1097
|
test th1-info-vars-2 {[lsort $RESULT] eq \ |
|
1098
|
[lsort "x th_stack_trace cmd_flags tcl_platform cmd_name cmd_args"]} |
|
1099
|
} else { |
|
1100
|
test th1-info-vars-2 {[lsort $RESULT] eq [lsort "x tcl_platform"]} |
|
1101
|
} |
|
1102
|
|
|
1103
|
############################################################################### |
|
1104
|
|
|
1105
|
fossil test-th-eval "set x 1; unset x; info vars" |
|
1106
|
|
|
1107
|
if {$th1Hooks} { |
|
1108
|
test th1-info-vars-3 {[lsort $RESULT] eq \ |
|
1109
|
[lsort "th_stack_trace cmd_flags tcl_platform cmd_name cmd_args"]} |
|
1110
|
} else { |
|
1111
|
test th1-info-vars-3 {$RESULT eq "tcl_platform"} |
|
1112
|
} |
|
1113
|
|
|
1114
|
############################################################################### |
|
1115
|
|
|
1116
|
fossil test-th-eval "proc foo {} {set x 1; info vars}; foo" |
|
1117
|
test th1-info-vars-4 {$RESULT eq "x"} |
|
1118
|
|
|
1119
|
############################################################################### |
|
1120
|
|
|
1121
|
fossil test-th-eval "set y 1; proc foo {} {set x 1; uplevel 1 {info vars}}; foo" |
|
1122
|
|
|
1123
|
if {$th1Hooks} { |
|
1124
|
test th1-info-vars-5 {[lsort $RESULT] eq \ |
|
1125
|
[lsort "th_stack_trace y cmd_flags tcl_platform cmd_name cmd_args"]} |
|
1126
|
} else { |
|
1127
|
test th1-info-vars-5 {[lsort $RESULT] eq [lsort "y tcl_platform"]} |
|
1128
|
} |
|
1129
|
|
|
1130
|
############################################################################### |
|
1131
|
|
|
1132
|
fossil test-th-eval "array exists foo" |
|
1133
|
test th1-array-exists-1 {$RESULT eq "0"} |
|
1134
|
|
|
1135
|
############################################################################### |
|
1136
|
|
|
1137
|
fossil test-th-eval "set foo(x) 1; array exists foo" |
|
1138
|
test th1-array-exists-2 {$RESULT eq "1"} |
|
1139
|
|
|
1140
|
############################################################################### |
|
1141
|
|
|
1142
|
fossil test-th-eval "set foo(x) 1; unset foo(x); array exists foo" |
|
1143
|
test th1-array-exists-3 {$RESULT eq "1"} |
|
1144
|
|
|
1145
|
############################################################################### |
|
1146
|
|
|
1147
|
fossil test-th-eval "set foo(x) 1; unset foo; array exists foo" |
|
1148
|
test th1-array-exists-4 {$RESULT eq "0"} |
|
1149
|
|
|
1150
|
############################################################################### |
|
1151
|
|
|
1152
|
fossil test-th-eval "set foo 1; array exists foo" |
|
1153
|
test th1-array-exists-5 {$RESULT eq "0"} |
|
1154
|
|
|
1155
|
############################################################################### |
|
1156
|
|
|
1157
|
fossil test-th-eval "array names foo" |
|
1158
|
test th1-array-names-1 {$RESULT eq ""} |
|
1159
|
|
|
1160
|
############################################################################### |
|
1161
|
|
|
1162
|
fossil test-th-eval "set foo 2; array names foo" |
|
1163
|
test th1-array-names-2 {$RESULT eq ""} |
|
1164
|
|
|
1165
|
############################################################################### |
|
1166
|
|
|
1167
|
fossil test-th-eval "set foo 2; unset foo; set foo(x) 2; array names foo" |
|
1168
|
test th1-array-names-3 {$RESULT eq "x"} |
|
1169
|
|
|
1170
|
############################################################################### |
|
1171
|
|
|
1172
|
fossil test-th-eval "set foo(x) 2; array names foo" |
|
1173
|
test th1-array-names-4 {$RESULT eq "x"} |
|
1174
|
|
|
1175
|
############################################################################### |
|
1176
|
|
|
1177
|
fossil test-th-eval "set foo(x) 2; set foo(y) 2; array names foo" |
|
1178
|
test th1-array-names-5 {$RESULT eq "x y"} |
|
1179
|
|
|
1180
|
############################################################################### |
|
1181
|
|
|
1182
|
fossil test-th-eval "set foo(x) 2; unset foo(x); array names foo" |
|
1183
|
test th1-array-names-6 {$RESULT eq ""} |
|
1184
|
|
|
1185
|
############################################################################### |
|
1186
|
|
|
1187
|
fossil test-th-eval "lsearch" |
|
1188
|
test th1-lsearch-1 {$RESULT eq \ |
|
1189
|
{TH_ERROR: wrong # args: should be "lsearch list string"}} |
|
1190
|
|
|
1191
|
############################################################################### |
|
1192
|
|
|
1193
|
fossil test-th-eval "lsearch a" |
|
1194
|
test th1-lsearch-2 {$RESULT eq \ |
|
1195
|
{TH_ERROR: wrong # args: should be "lsearch list string"}} |
|
1196
|
|
|
1197
|
############################################################################### |
|
1198
|
|
|
1199
|
fossil test-th-eval "lsearch a a a" |
|
1200
|
test th1-lsearch-3 {$RESULT eq \ |
|
1201
|
{TH_ERROR: wrong # args: should be "lsearch list string"}} |
|
1202
|
|
|
1203
|
############################################################################### |
|
1204
|
|
|
1205
|
fossil test-th-eval "lsearch {a b c} a" |
|
1206
|
test th1-lsearch-4 {$RESULT eq "0"} |
|
1207
|
|
|
1208
|
############################################################################### |
|
1209
|
|
|
1210
|
fossil test-th-eval "lsearch {a b c} b" |
|
1211
|
test th1-lsearch-5 {$RESULT eq "1"} |
|
1212
|
|
|
1213
|
############################################################################### |
|
1214
|
|
|
1215
|
fossil test-th-eval "lsearch {a b c} c" |
|
1216
|
test th1-lsearch-6 {$RESULT eq "2"} |
|
1217
|
|
|
1218
|
############################################################################### |
|
1219
|
|
|
1220
|
fossil test-th-eval "lsearch {a b c} d" |
|
1221
|
test th1-lsearch-7 {$RESULT eq "-1"} |
|
1222
|
|
|
1223
|
############################################################################### |
|
1224
|
|
|
1225
|
fossil test-th-eval "lsearch {a b c} aa" |
|
1226
|
test th1-lsearch-8 {$RESULT eq "-1"} |
|
1227
|
|
|
1228
|
############################################################################### |
|
1229
|
|
|
1230
|
fossil test-th-eval "lsearch {aa b c} a" |
|
1231
|
test th1-lsearch-9 {$RESULT eq "-1"} |
|
1232
|
|
|
1233
|
############################################################################### |
|
1234
|
|
|
1235
|
fossil test-th-eval "lsearch \"\{aa b c\" a" |
|
1236
|
test th1-lsearch-10 {$RESULT eq "TH_ERROR: Expected list, got: \"\{aa b c\""} |
|
1237
|
|
|
1238
|
############################################################################### |
|
1239
|
|
|
1240
|
fossil test-th-eval "glob_match" |
|
1241
|
test th1-glob-match-1 {$RESULT eq \ |
|
1242
|
{TH_ERROR: wrong # args: should be "glob_match ?-one? ?--? patternList string"}} |
|
1243
|
|
|
1244
|
############################################################################### |
|
1245
|
|
|
1246
|
fossil test-th-eval "glob_match -one" |
|
1247
|
test th1-glob-match-2 {$RESULT eq \ |
|
1248
|
{TH_ERROR: wrong # args: should be "glob_match ?-one? ?--? patternList string"}} |
|
1249
|
|
|
1250
|
############################################################################### |
|
1251
|
|
|
1252
|
fossil test-th-eval "glob_match --" |
|
1253
|
test th1-glob-match-3 {$RESULT eq \ |
|
1254
|
{TH_ERROR: wrong # args: should be "glob_match ?-one? ?--? patternList string"}} |
|
1255
|
|
|
1256
|
############################################################################### |
|
1257
|
|
|
1258
|
fossil test-th-eval "glob_match -one --" |
|
1259
|
test th1-glob-match-4 {$RESULT eq \ |
|
1260
|
{TH_ERROR: wrong # args: should be "glob_match ?-one? ?--? patternList string"}} |
|
1261
|
|
|
1262
|
############################################################################### |
|
1263
|
|
|
1264
|
fossil test-th-eval "glob_match -one -- 1" |
|
1265
|
test th1-glob-match-5 {$RESULT eq \ |
|
1266
|
{TH_ERROR: wrong # args: should be "glob_match ?-one? ?--? patternList string"}} |
|
1267
|
|
|
1268
|
############################################################################### |
|
1269
|
|
|
1270
|
fossil test-th-eval "glob_match -one -- 1 2 3" |
|
1271
|
test th1-glob-match-6 {$RESULT eq \ |
|
1272
|
{TH_ERROR: wrong # args: should be "glob_match ?-one? ?--? patternList string"}} |
|
1273
|
|
|
1274
|
############################################################################### |
|
1275
|
|
|
1276
|
fossil test-th-eval {list [glob_match a A] [glob_match A a]} |
|
1277
|
test th1-glob-match-7 {$RESULT eq "0 0"} |
|
1278
|
|
|
1279
|
############################################################################### |
|
1280
|
|
|
1281
|
fossil test-th-eval {list [glob_match a,b a] [glob_match a,b b]} |
|
1282
|
test th1-glob-match-8 {$RESULT eq "1 2"} |
|
1283
|
|
|
1284
|
############################################################################### |
|
1285
|
|
|
1286
|
fossil test-th-eval {list [glob_match -one a,b a] [glob_match -one a,b b]} |
|
1287
|
test th1-glob-match-9 {$RESULT eq "0 0"} |
|
1288
|
|
|
1289
|
############################################################################### |
|
1290
|
|
|
1291
|
fossil test-th-eval {list [glob_match -one a,b a,b] [glob_match -one a b,a]} |
|
1292
|
test th1-glob-match-10 {$RESULT eq "1 0"} |
|
1293
|
|
|
1294
|
############################################################################### |
|
1295
|
|
|
1296
|
fossil test-th-eval {list [glob_match a*c abc] [glob_match abc a*c]} |
|
1297
|
test th1-glob-match-11 {$RESULT eq "1 0"} |
|
1298
|
|
|
1299
|
############################################################################### |
|
1300
|
|
|
1301
|
fossil test-th-eval {list [glob_match a?c abc] [glob_match abc a?c]} |
|
1302
|
test th1-glob-match-12 {$RESULT eq "1 0"} |
|
1303
|
|
|
1304
|
############################################################################### |
|
1305
|
|
|
1306
|
fossil test-th-eval {list [glob_match {a[bd]c} abc] [glob_match abc {a[bd]c}]} |
|
1307
|
test th1-glob-match-13 {$RESULT eq "1 0"} |
|
1308
|
|
|
1309
|
############################################################################### |
|
1310
|
|
|
1311
|
fossil test-th-eval {string is} |
|
1312
|
test th1-string-is-1 {$RESULT eq \ |
|
1313
|
{TH_ERROR: wrong # args: should be "string is class string"}} |
|
1314
|
|
|
1315
|
############################################################################### |
|
1316
|
|
|
1317
|
fossil test-th-eval {string is something} |
|
1318
|
test th1-string-is-2 {$RESULT eq \ |
|
1319
|
{TH_ERROR: wrong # args: should be "string is class string"}} |
|
1320
|
|
|
1321
|
############################################################################### |
|
1322
|
|
|
1323
|
fossil test-th-eval {string is not something else} |
|
1324
|
test th1-string-is-3 {$RESULT eq \ |
|
1325
|
{TH_ERROR: wrong # args: should be "string is class string"}} |
|
1326
|
|
|
1327
|
############################################################################### |
|
1328
|
|
|
1329
|
fossil test-th-eval {string is other 123} |
|
1330
|
test th1-string-is-4 {$RESULT eq \ |
|
1331
|
"TH_ERROR: Expected alnum, double, integer, list, or tainted, got: other"} |
|
1332
|
|
|
1333
|
############################################################################### |
|
1334
|
|
|
1335
|
fossil test-th-eval {string is alnum 123} |
|
1336
|
test th1-string-is-5 {$RESULT eq "1"} |
|
1337
|
|
|
1338
|
############################################################################### |
|
1339
|
|
|
1340
|
fossil test-th-eval {string is alnum abc} |
|
1341
|
test th1-string-is-6 {$RESULT eq "1"} |
|
1342
|
|
|
1343
|
############################################################################### |
|
1344
|
|
|
1345
|
fossil test-th-eval {string is alnum 123abc} |
|
1346
|
test th1-string-is-7 {$RESULT eq "1"} |
|
1347
|
|
|
1348
|
############################################################################### |
|
1349
|
|
|
1350
|
fossil test-th-eval {string is alnum abc123} |
|
1351
|
test th1-string-is-8 {$RESULT eq "1"} |
|
1352
|
|
|
1353
|
############################################################################### |
|
1354
|
|
|
1355
|
fossil test-th-eval {string is alnum _abc123} |
|
1356
|
test th1-string-is-9 {$RESULT eq "0"} |
|
1357
|
|
|
1358
|
############################################################################### |
|
1359
|
|
|
1360
|
fossil test-th-eval {string is alnum abc.123} |
|
1361
|
test th1-string-is-10 {$RESULT eq "0"} |
|
1362
|
|
|
1363
|
############################################################################### |
|
1364
|
|
|
1365
|
fossil test-th-eval {string is alnum abc123_} |
|
1366
|
test th1-string-is-11 {$RESULT eq "0"} |
|
1367
|
|
|
1368
|
############################################################################### |
|
1369
|
|
|
1370
|
fossil test-th-eval {string is list ""} |
|
1371
|
test th1-string-is-12 {$RESULT eq "1"} |
|
1372
|
|
|
1373
|
############################################################################### |
|
1374
|
|
|
1375
|
fossil test-th-eval {string is list 1} |
|
1376
|
test th1-string-is-13 {$RESULT eq "1"} |
|
1377
|
|
|
1378
|
############################################################################### |
|
1379
|
|
|
1380
|
fossil test-th-eval {string is list "1 2 3"} |
|
1381
|
test th1-string-is-14 {$RESULT eq "1"} |
|
1382
|
|
|
1383
|
############################################################################### |
|
1384
|
|
|
1385
|
fossil test-th-eval {string is list "\{"} |
|
1386
|
test th1-string-is-15 {$RESULT eq "0"} |
|
1387
|
|
|
1388
|
############################################################################### |
|
1389
|
|
|
1390
|
fossil test-th-eval {string is list "1 2 3 \{"} |
|
1391
|
test th1-string-is-16 {$RESULT eq "0"} |
|
1392
|
|
|
1393
|
############################################################################### |
|
1394
|
|
|
1395
|
fossil test-th-eval {string is list "1 2 3 \{\}"} |
|
1396
|
test th1-string-is-17 {$RESULT eq "1"} |
|
1397
|
|
|
1398
|
############################################################################### |
|
1399
|
|
|
1400
|
fossil test-th-eval {string is list "1 2 3 \{\{\}"} |
|
1401
|
test th1-string-is-18 {$RESULT eq "0"} |
|
1402
|
|
|
1403
|
############################################################################### |
|
1404
|
|
|
1405
|
fossil test-th-eval {string is double 123} |
|
1406
|
test th1-string-is-19 {$RESULT eq "1"} |
|
1407
|
|
|
1408
|
############################################################################### |
|
1409
|
|
|
1410
|
fossil test-th-eval {string is double 123.456} |
|
1411
|
test th1-string-is-20 {$RESULT eq "1"} |
|
1412
|
|
|
1413
|
############################################################################### |
|
1414
|
|
|
1415
|
fossil test-th-eval {string is double 123abc} |
|
1416
|
test th1-string-is-21 {$RESULT eq "0"} |
|
1417
|
|
|
1418
|
############################################################################### |
|
1419
|
|
|
1420
|
fossil test-th-eval {string is double 123_456} |
|
1421
|
test th1-string-is-22 {$RESULT eq "0"} |
|
1422
|
|
|
1423
|
############################################################################### |
|
1424
|
|
|
1425
|
fossil test-th-eval {string is integer 123} |
|
1426
|
test th1-string-is-23 {$RESULT eq "1"} |
|
1427
|
|
|
1428
|
############################################################################### |
|
1429
|
|
|
1430
|
fossil test-th-eval {string is integer 123.456} |
|
1431
|
test th1-string-is-24 {$RESULT eq "0"} |
|
1432
|
|
|
1433
|
############################################################################### |
|
1434
|
|
|
1435
|
fossil test-th-eval {string is integer 123abc} |
|
1436
|
test th1-string-is-25 {$RESULT eq "0"} |
|
1437
|
|
|
1438
|
############################################################################### |
|
1439
|
|
|
1440
|
fossil test-th-eval {string is integer 0b11001001} |
|
1441
|
test th1-string-is-26 {$RESULT eq "1"} |
|
1442
|
|
|
1443
|
############################################################################### |
|
1444
|
|
|
1445
|
fossil test-th-eval {string is integer 0b11001002} |
|
1446
|
test th1-string-is-27 {$RESULT eq "0"} |
|
1447
|
|
|
1448
|
############################################################################### |
|
1449
|
|
|
1450
|
fossil test-th-eval {string is integer 0o777} |
|
1451
|
test th1-string-is-28 {$RESULT eq "1"} |
|
1452
|
|
|
1453
|
############################################################################### |
|
1454
|
|
|
1455
|
fossil test-th-eval {string is integer 0o778} |
|
1456
|
test th1-string-is-29 {$RESULT eq "0"} |
|
1457
|
|
|
1458
|
############################################################################### |
|
1459
|
|
|
1460
|
fossil test-th-eval {string is integer 0xC0DEF00D} |
|
1461
|
test th1-string-is-30 {$RESULT eq "1"} |
|
1462
|
|
|
1463
|
############################################################################### |
|
1464
|
|
|
1465
|
fossil test-th-eval {string is integer 0xC0DEF00Z} |
|
1466
|
test th1-string-is-31 {$RESULT eq "0"} |
|
1467
|
|
|
1468
|
############################################################################### |
|
1469
|
|
|
1470
|
fossil test-th-eval {string index "" -1} |
|
1471
|
test th1-string-index-1 {$RESULT eq ""} |
|
1472
|
|
|
1473
|
############################################################################### |
|
1474
|
|
|
1475
|
fossil test-th-eval {string index "" 0} |
|
1476
|
test th1-string-index-2 {$RESULT eq ""} |
|
1477
|
|
|
1478
|
############################################################################### |
|
1479
|
|
|
1480
|
fossil test-th-eval {string index "" 1} |
|
1481
|
test th1-string-index-3 {$RESULT eq ""} |
|
1482
|
|
|
1483
|
############################################################################### |
|
1484
|
|
|
1485
|
fossil test-th-eval {string index "" 2} |
|
1486
|
test th1-string-index-4 {$RESULT eq ""} |
|
1487
|
|
|
1488
|
############################################################################### |
|
1489
|
|
|
1490
|
fossil test-th-eval {string index "" end} |
|
1491
|
test th1-string-index-5 {$RESULT eq ""} |
|
1492
|
|
|
1493
|
############################################################################### |
|
1494
|
|
|
1495
|
fossil test-th-eval {string index A -1} |
|
1496
|
test th1-string-index-6 {$RESULT eq ""} |
|
1497
|
|
|
1498
|
############################################################################### |
|
1499
|
|
|
1500
|
fossil test-th-eval {string index A 0} |
|
1501
|
test th1-string-index-7 {$RESULT eq "A"} |
|
1502
|
|
|
1503
|
############################################################################### |
|
1504
|
|
|
1505
|
fossil test-th-eval {string index A 1} |
|
1506
|
test th1-string-index-8 {$RESULT eq ""} |
|
1507
|
|
|
1508
|
############################################################################### |
|
1509
|
|
|
1510
|
fossil test-th-eval {string index A 2} |
|
1511
|
test th1-string-index-9 {$RESULT eq ""} |
|
1512
|
|
|
1513
|
############################################################################### |
|
1514
|
|
|
1515
|
fossil test-th-eval {string index A end} |
|
1516
|
test th1-string-index-10 {$RESULT eq "A"} |
|
1517
|
|
|
1518
|
############################################################################### |
|
1519
|
|
|
1520
|
fossil test-th-eval {string index ABC -1} |
|
1521
|
test th1-string-index-11 {$RESULT eq ""} |
|
1522
|
|
|
1523
|
############################################################################### |
|
1524
|
|
|
1525
|
fossil test-th-eval {string index ABC 0} |
|
1526
|
test th1-string-index-12 {$RESULT eq "A"} |
|
1527
|
|
|
1528
|
############################################################################### |
|
1529
|
|
|
1530
|
fossil test-th-eval {string index ABC 1} |
|
1531
|
test th1-string-index-13 {$RESULT eq "B"} |
|
1532
|
|
|
1533
|
############################################################################### |
|
1534
|
|
|
1535
|
fossil test-th-eval {string index ABC 2} |
|
1536
|
test th1-string-index-14 {$RESULT eq "C"} |
|
1537
|
|
|
1538
|
############################################################################### |
|
1539
|
|
|
1540
|
fossil test-th-eval {string index ABC end} |
|
1541
|
test th1-string-index-15 {$RESULT eq "C"} |
|
1542
|
|
|
1543
|
############################################################################### |
|
1544
|
|
|
1545
|
fossil test-th-eval {markdown} |
|
1546
|
test th1-markdown-1 {$RESULT eq \ |
|
1547
|
{TH_ERROR: wrong # args: should be "markdown STRING"}} |
|
1548
|
|
|
1549
|
############################################################################### |
|
1550
|
|
|
1551
|
fossil test-th-eval {markdown one two} |
|
1552
|
test th1-markdown-2 {$RESULT eq \ |
|
1553
|
{TH_ERROR: wrong # args: should be "markdown STRING"}} |
|
1554
|
|
|
1555
|
############################################################################### |
|
1556
|
|
|
1557
|
fossil test-th-eval {markdown "*This is a test.*"} |
|
1558
|
test th1-markdown-3 {[normalize_result] eq {{} {<div class="markdown"> |
|
1559
|
|
|
1560
|
<p><em>This is a test.</em></p> |
|
1561
|
|
|
1562
|
</div> |
|
1563
|
}}} |
|
1564
|
|
|
1565
|
############################################################################### |
|
1566
|
|
|
1567
|
fossil test-th-eval {markdown "Test1\n=====\n*This is a test.*"} |
|
1568
|
test th1-markdown-4 {[normalize_result] eq {Test1 {<div class="markdown"> |
|
1569
|
|
|
1570
|
<p><em>This is a test.</em></p> |
|
1571
|
|
|
1572
|
</div> |
|
1573
|
}}} |
|
1574
|
|
|
1575
|
############################################################################### |
|
1576
|
|
|
1577
|
set markdown [read_file [file join $path markdown-test1.md]] |
|
1578
|
fossil test-th-eval [string map \ |
|
1579
|
[list %markdown% $markdown] {markdown {%markdown%}}] |
|
1580
|
test th1-markdown-5 {[normalize_result] eq \ |
|
1581
|
{{Markdown Formatter Test Document} {<div class="markdown"> |
|
1582
|
|
|
1583
|
<p>This document is designed to test the markdown formatter.</p> |
|
1584
|
|
|
1585
|
<ul> |
|
1586
|
<li>A bullet item. |
|
1587
|
|
|
1588
|
<ul> |
|
1589
|
<li>A subitem</li> |
|
1590
|
</ul></li> |
|
1591
|
<li>Second bullet</li> |
|
1592
|
</ul> |
|
1593
|
|
|
1594
|
<p>More text</p> |
|
1595
|
|
|
1596
|
<ol> |
|
1597
|
<li>Enumeration |
|
1598
|
1.1. Subitem 1 |
|
1599
|
1.2. Subitem 2</li> |
|
1600
|
<li>Second enumeration.</li> |
|
1601
|
</ol> |
|
1602
|
|
|
1603
|
<p>Another paragraph.</p> |
|
1604
|
|
|
1605
|
<h2>Other Features</h2> |
|
1606
|
<p>Text can show <em>emphasis</em> or <em>emphasis</em> or <strong>strong emphassis</strong>.</p> |
|
1607
|
|
|
1608
|
</div> |
|
1609
|
}}} |
|
1610
|
|
|
1611
|
############################################################################### |
|
1612
|
|
|
1613
|
# Verify that quoted delimiters like * and _ don't terminate their |
|
1614
|
# span. This was fixed by checkin [dd41f85acf]. |
|
1615
|
fossil test-th-eval {markdown "*This is\\*a test.*\n_second\\_test_"} |
|
1616
|
test th1-markdown-6 {[normalize_result] eq {{} {<div class="markdown"> |
|
1617
|
|
|
1618
|
<p><em>This is*a test.</em> |
|
1619
|
<em>second_test</em></p> |
|
1620
|
|
|
1621
|
</div> |
|
1622
|
}}} |
|
1623
|
|
|
1624
|
############################################################################### |
|
1625
|
|
|
1626
|
fossil test-th-eval {encode64 test} |
|
1627
|
test th1-encode64-1 {$RESULT eq "dGVzdA=="} |
|
1628
|
|
|
1629
|
############################################################################### |
|
1630
|
|
|
1631
|
fossil test-th-eval {encode64 test\x00} |
|
1632
|
test th1-encode64-2 {$RESULT eq "dGVzdAA="} |
|
1633
|
|
|
1634
|
############################################################################### |
|
1635
|
|
|
1636
|
# |
|
1637
|
# This test will fail if the Fossil source file named below changes. Update |
|
1638
|
# the expected result string below if that happens. |
|
1639
|
# |
|
1640
|
test_in_checkout th1-encode64-3 { |
|
1641
|
fossil test-th-eval --open-config \ |
|
1642
|
{encode64 [artifact trunk ajax/cgi-bin/fossil-json.cgi.example]} |
|
1643
|
} { |
|
1644
|
$RESULT eq "IyEvcGF0aC90by9mb3NzaWwvYmluYXJ5CnJlcG9zaXRvcnk6IC9wYXRoL3RvL3JlcG8uZnNsCg==" |
|
1645
|
} |
|
1646
|
|
|
1647
|
############################################################################### |
|
1648
|
|
|
1649
|
fossil test-th-eval {array exists tcl_platform} |
|
1650
|
test th1-platform-1 {$RESULT eq "1"} |
|
1651
|
|
|
1652
|
############################################################################### |
|
1653
|
|
|
1654
|
fossil test-th-eval {array names tcl_platform} |
|
1655
|
test th1-platform-2 {$RESULT eq "engine platform"} |
|
1656
|
|
|
1657
|
############################################################################### |
|
1658
|
|
|
1659
|
fossil test-th-eval {set tcl_platform(engine)} |
|
1660
|
test th1-platform-3 {$RESULT eq "TH1"} |
|
1661
|
|
|
1662
|
############################################################################### |
|
1663
|
|
|
1664
|
fossil test-th-eval {set tcl_platform(platform)} |
|
1665
|
test th1-platform-4 {$RESULT eq "windows" || $RESULT eq "unix"} |
|
1666
|
|
|
1667
|
############################################################################### |
|
1668
|
|
|
1669
|
set th1FileName [file join $::tempPath th1-[pid].th1] |
|
1670
|
|
|
1671
|
write_file $th1FileName { |
|
1672
|
set x "" |
|
1673
|
for {set i 0} {$i < 10} {set i [expr {$i + 1}]} { |
|
1674
|
set x "$x $i" |
|
1675
|
} |
|
1676
|
return [string trim $x] |
|
1677
|
set y; # NOTE: Never hit. |
|
1678
|
} |
|
1679
|
|
|
1680
|
fossil test-th-source $th1FileName |
|
1681
|
test th1-source-1 {$RESULT eq {TH_RETURN: 0 1 2 3 4 5 6 7 8 9}} |
|
1682
|
file delete $th1FileName |
|
1683
|
|
|
1684
|
############################################################################### |
|
1685
|
|
|
1686
|
# Tests for the TH1 unversioned command require at least one |
|
1687
|
# unversioned file in the repository. All tests run in a freshly |
|
1688
|
# created checkout of a freshly created repo, so we can just |
|
1689
|
# create a file or two for the purpose. |
|
1690
|
write_file ten.txt "0123456789" |
|
1691
|
fossil unversioned add ten.txt |
|
1692
|
fossil unversioned list |
|
1693
|
|
|
1694
|
# unversioned list |
|
1695
|
fossil test-th-eval --open-config "unversioned list" |
|
1696
|
test th1-unversioned-1 {[normalize_result] eq {ten.txt}} |
|
1697
|
|
|
1698
|
# unversioned content |
|
1699
|
fossil test-th-eval --open-config \ |
|
1700
|
{string length [unversioned content ten.txt]} |
|
1701
|
test th1-unversioned-2 {$RESULT eq {10}} |
|
1702
|
|
|
1703
|
|
|
1704
|
############################################################################### |
|
1705
|
|
|
1706
|
test_cleanup |
|
1707
|
|