OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [insight/] [tcl/] [tests/] [fileName.test] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 578 markom
# This file tests the filename manipulation routines.
2
#
3
# This file contains a collection of tests for one or more of the Tcl
4
# built-in commands.  Sourcing this file into Tcl runs the tests and
5
# generates output for errors.  No output means no errors were found.
6
#
7
# Copyright (c) 1995-1996 Sun Microsystems, Inc.
8
#
9
# See the file "license.terms" for information on usage and redistribution
10
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
11
#
12
# RCS: @(#) $Id: fileName.test,v 1.1.1.1 2002-01-16 10:25:36 markom Exp $
13
 
14
if {[string compare test [info procs test]] == 1} then {source defs}
15
 
16
if {[info commands testsetplatform] == {}} {
17
    puts "This application hasn't been compiled with the \"testsetplatform\""
18
    puts "command, so I can't test the filename conversion procedures."
19
    return
20
}
21
 
22
global env
23
set platform [testgetplatform]
24
 
25
test filename-1.1 {Tcl_GetPathType: unix} {
26
    testsetplatform unix
27
    file pathtype /
28
} absolute
29
test filename-1.2 {Tcl_GetPathType: unix} {
30
    testsetplatform unix
31
    file pathtype /foo
32
} absolute
33
test filename-1.3 {Tcl_GetPathType: unix} {
34
    testsetplatform unix
35
    file pathtype foo
36
} relative
37
test filename-1.4 {Tcl_GetPathType: unix} {
38
    testsetplatform unix
39
    file pathtype c:/foo
40
} relative
41
test filename-1.5 {Tcl_GetPathType: unix} {
42
    testsetplatform unix
43
    file pathtype ~
44
} absolute
45
test filename-1.6 {Tcl_GetPathType: unix} {
46
    testsetplatform unix
47
    file pathtype ~/foo
48
} absolute
49
test filename-1.7 {Tcl_GetPathType: unix} {
50
    testsetplatform unix
51
    file pathtype ~foo
52
} absolute
53
test filename-1.8 {Tcl_GetPathType: unix} {
54
    testsetplatform unix
55
    file pathtype ./~foo
56
} relative
57
 
58
test filename-2.1 {Tcl_GetPathType: mac, denerate names} {
59
    testsetplatform mac
60
    file pathtype /
61
} relative
62
test filename-2.2 {Tcl_GetPathType: mac, denerate names} {
63
    testsetplatform mac
64
    file pathtype /.
65
} relative
66
test filename-2.3 {Tcl_GetPathType: mac, denerate names} {
67
    testsetplatform mac
68
    file pathtype /..
69
} relative
70
test filename-2.4 {Tcl_GetPathType: mac, denerate names} {
71
    testsetplatform mac
72
    file pathtype //.//
73
} relative
74
test filename-2.5 {Tcl_GetPathType: mac, denerate names} {
75
    testsetplatform mac
76
    file pathtype //.//../.
77
} relative
78
test filename-2.6 {Tcl_GetPathType: mac, tilde names} {
79
    testsetplatform mac
80
    file pathtype ~
81
} absolute
82
test filename-2.7 {Tcl_GetPathType: mac, tilde names} {
83
    testsetplatform mac
84
    file pathtype ~:
85
} absolute
86
test filename-2.8 {Tcl_GetPathType: mac, tilde names} {
87
    testsetplatform mac
88
    file pathtype ~:foo
89
} absolute
90
test filename-2.9 {Tcl_GetPathType: mac, tilde names} {
91
    testsetplatform mac
92
    file pathtype ~/
93
} absolute
94
test filename-2.10 {Tcl_GetPathType: mac, tilde names} {
95
    testsetplatform mac
96
    file pathtype ~/foo
97
} absolute
98
test filename-2.11 {Tcl_GetPathType: mac, unix-style names} {
99
    testsetplatform mac
100
    file pathtype /foo
101
} absolute
102
test filename-2.12 {Tcl_GetPathType: mac, unix-style names} {
103
    testsetplatform mac
104
    file pathtype /./foo
105
} absolute
106
test filename-2.13 {Tcl_GetPathType: mac, unix-style names} {
107
    testsetplatform mac
108
    file pathtype /..//./foo
109
} absolute
110
test filename-2.14 {Tcl_GetPathType: mac, unix-style names} {
111
    testsetplatform mac
112
    file pathtype /foo/bar
113
} absolute
114
test filename-2.15 {Tcl_GetPathType: mac, unix-style names} {
115
    testsetplatform mac
116
    file pathtype foo/bar
117
} relative
118
test filename-2.16 {Tcl_GetPathType: mac, mac-style names} {
119
    testsetplatform mac
120
    file pathtype :
121
} relative
122
test filename-2.17 {Tcl_GetPathType: mac, mac-style names} {
123
    testsetplatform mac
124
    file pathtype :foo
125
} relative
126
test filename-2.18 {Tcl_GetPathType: mac, mac-style names} {
127
    testsetplatform mac
128
    file pathtype foo:
129
} absolute
130
test filename-2.19 {Tcl_GetPathType: mac, mac-style names} {
131
    testsetplatform mac
132
    file pathtype foo:bar
133
} absolute
134
test filename-2.20 {Tcl_GetPathType: mac, mac-style names} {
135
    testsetplatform mac
136
    file pathtype :foo:bar
137
} relative
138
test filename-2.21 {Tcl_GetPathType: mac, mac-style names} {
139
    testsetplatform mac
140
    file pathtype ::foo:bar
141
} relative
142
test filename-2.22 {Tcl_GetPathType: mac, mac-style names} {
143
    testsetplatform mac
144
    file pathtype ~foo
145
} absolute
146
test filename-2.23 {Tcl_GetPathType: mac, mac-style names} {
147
    testsetplatform mac
148
    file pathtype :~foo
149
} relative
150
test filename-2.24 {Tcl_GetPathType: mac, mac-style names} {
151
    testsetplatform mac
152
    file pathtype ~foo:
153
} absolute
154
test filename-2.25 {Tcl_GetPathType: mac, mac-style names} {
155
    testsetplatform mac
156
    file pathtype foo/bar:
157
} absolute
158
test filename-2.26 {Tcl_GetPathType: mac, mac-style names} {
159
    testsetplatform mac
160
    file pathtype /foo:
161
} absolute
162
test filename-2.27 {Tcl_GetPathType: mac, mac-style names} {
163
    testsetplatform mac
164
    file pathtype foo
165
} relative
166
 
167
test filename-3.1 {Tcl_GetPathType: windows} {
168
    testsetplatform windows
169
    file pathtype /
170
} volumerelative
171
test filename-3.2 {Tcl_GetPathType: windows} {
172
    testsetplatform windows
173
    file pathtype \\
174
} volumerelative
175
test filename-3.3 {Tcl_GetPathType: windows} {
176
    testsetplatform windows
177
    file pathtype /foo
178
} volumerelative
179
test filename-3.4 {Tcl_GetPathType: windows} {
180
    testsetplatform windows
181
    file pathtype \\foo
182
} volumerelative
183
test filename-3.5 {Tcl_GetPathType: windows} {
184
    testsetplatform windows
185
    file pathtype c:/
186
} absolute
187
test filename-3.6 {Tcl_GetPathType: windows} {
188
    testsetplatform windows
189
    file pathtype c:\\
190
} absolute
191
test filename-3.7 {Tcl_GetPathType: windows} {
192
    testsetplatform windows
193
    file pathtype c:/foo
194
} absolute
195
test filename-3.8 {Tcl_GetPathType: windows} {
196
    testsetplatform windows
197
    file pathtype c:\\foo
198
} absolute
199
test filename-3.9 {Tcl_GetPathType: windows} {
200
    testsetplatform windows
201
    file pathtype c:
202
} volumerelative
203
test filename-3.10 {Tcl_GetPathType: windows} {
204
    testsetplatform windows
205
    file pathtype c:foo
206
} volumerelative
207
test filename-3.11 {Tcl_GetPathType: windows} {
208
    testsetplatform windows
209
    file pathtype foo
210
} relative
211
test filename-3.12 {Tcl_GetPathType: windows} {
212
    testsetplatform windows
213
    file pathtype //foo/bar
214
} absolute
215
test filename-3.13 {Tcl_GetPathType: windows} {
216
    testsetplatform windows
217
    file pathtype ~foo
218
} absolute
219
test filename-3.14 {Tcl_GetPathType: windows} {
220
    testsetplatform windows
221
    file pathtype ~
222
} absolute
223
test filename-3.15 {Tcl_GetPathType: windows} {
224
    testsetplatform windows
225
    file pathtype ~/foo
226
} absolute
227
test filename-3.16 {Tcl_GetPathType: windows} {
228
    testsetplatform windows
229
    file pathtype ./~foo
230
} relative
231
 
232
test filename-4.1 {Tcl_SplitPath: unix} {
233
    testsetplatform unix
234
    file split /
235
} {/}
236
test filename-4.2 {Tcl_SplitPath: unix} {
237
    testsetplatform unix
238
    file split /foo
239
} {/ foo}
240
test filename-4.3 {Tcl_SplitPath: unix} {
241
    testsetplatform unix
242
    file split /foo/bar
243
} {/ foo bar}
244
test filename-4.4 {Tcl_SplitPath: unix} {
245
    testsetplatform unix
246
    file split /foo/bar/baz
247
} {/ foo bar baz}
248
test filename-4.5 {Tcl_SplitPath: unix} {
249
    testsetplatform unix
250
    file split foo/bar
251
} {foo bar}
252
test filename-4.6 {Tcl_SplitPath: unix} {
253
    testsetplatform unix
254
    file split ./foo/bar
255
} {. foo bar}
256
test filename-4.7 {Tcl_SplitPath: unix} {
257
    testsetplatform unix
258
    file split /foo/../././foo/bar
259
} {/ foo .. . . foo bar}
260
test filename-4.8 {Tcl_SplitPath: unix} {
261
    testsetplatform unix
262
    file split ../foo/bar
263
} {.. foo bar}
264
test filename-4.9 {Tcl_SplitPath: unix} {
265
    testsetplatform unix
266
    file split {}
267
} {}
268
test filename-4.10 {Tcl_SplitPath: unix} {
269
    testsetplatform unix
270
    file split .
271
} {.}
272
test filename-4.11 {Tcl_SplitPath: unix} {
273
    testsetplatform unix
274
    file split ../
275
} {..}
276
test filename-4.12 {Tcl_SplitPath: unix} {
277
    testsetplatform unix
278
    file split ../..
279
} {.. ..}
280
test filename-4.13 {Tcl_SplitPath: unix} {
281
    testsetplatform unix
282
    file split //foo
283
} {/ foo}
284
test filename-4.14 {Tcl_SplitPath: unix} {
285
    testsetplatform unix
286
    file split foo//bar
287
} {foo bar}
288
test filename-4.15 {Tcl_SplitPath: unix} {
289
    testsetplatform unix
290
    file split ~foo
291
} {~foo}
292
test filename-4.16 {Tcl_SplitPath: unix} {
293
    testsetplatform unix
294
    file split ~foo/~bar
295
} {~foo ./~bar}
296
test filename-4.17 {Tcl_SplitPath: unix} {
297
    testsetplatform unix
298
    file split ~foo/~bar/~baz
299
} {~foo ./~bar ./~baz}
300
test filename-4.18 {Tcl_SplitPath: unix} {
301
    testsetplatform unix
302
    file split foo/bar~/baz
303
} {foo bar~ baz}
304
 
305
test filename-5.1 {Tcl_SplitPath: mac} {
306
    testsetplatform mac
307
    file split a:b
308
} {a: b}
309
test filename-5.2 {Tcl_SplitPath: mac} {
310
    testsetplatform mac
311
    file split a:b:c
312
} {a: b c}
313
test filename-5.3 {Tcl_SplitPath: mac} {
314
    testsetplatform mac
315
    file split a:b:c:
316
} {a: b c}
317
test filename-5.4 {Tcl_SplitPath: mac} {
318
    testsetplatform mac
319
    file split a:
320
} {a:}
321
test filename-5.5 {Tcl_SplitPath: mac} {
322
    testsetplatform mac
323
    file split a::
324
} {a: ::}
325
test filename-5.6 {Tcl_SplitPath: mac} {
326
    testsetplatform mac
327
    file split a:::
328
} {a: :: ::}
329
test filename-5.7 {Tcl_SplitPath: mac} {
330
    testsetplatform mac
331
    file split :a
332
} {a}
333
test filename-5.8 {Tcl_SplitPath: mac} {
334
    testsetplatform mac
335
    file split :a::
336
} {a ::}
337
test filename-5.9 {Tcl_SplitPath: mac} {
338
    testsetplatform mac
339
    file split :
340
} {:}
341
test filename-5.10 {Tcl_SplitPath: mac} {
342
    testsetplatform mac
343
    file split ::
344
} {::}
345
test filename-5.11 {Tcl_SplitPath: mac} {
346
    testsetplatform mac
347
    file split :::
348
} {:: ::}
349
test filename-5.12 {Tcl_SplitPath: mac} {
350
    testsetplatform mac
351
    file split a:::b
352
} {a: :: :: b}
353
test filename-5.13 {Tcl_SplitPath: mac} {
354
    testsetplatform mac
355
    file split /a:b
356
} {/a: b}
357
test filename-5.14 {Tcl_SplitPath: mac} {
358
    testsetplatform mac
359
    file split ~:
360
} {~:}
361
test filename-5.15 {Tcl_SplitPath: mac} {
362
    testsetplatform mac
363
    file split ~/:
364
} {~/:}
365
test filename-5.16 {Tcl_SplitPath: mac} {
366
    testsetplatform mac
367
    file split ~:foo
368
} {~: foo}
369
test filename-5.17 {Tcl_SplitPath: mac} {
370
    testsetplatform mac
371
    file split ~/foo
372
} {~: foo}
373
test filename-5.18 {Tcl_SplitPath: mac} {
374
    testsetplatform mac
375
    file split ~foo:
376
} {~foo:}
377
test filename-5.19 {Tcl_SplitPath: mac} {
378
    testsetplatform mac
379
    file split a:~foo
380
} {a: :~foo}
381
test filename-5.20 {Tcl_SplitPath: mac} {
382
    testsetplatform mac
383
    file split /
384
} {:/}
385
test filename-5.21 {Tcl_SplitPath: mac} {
386
    testsetplatform mac
387
    file split a:b/c
388
} {a: :b/c}
389
test filename-5.22 {Tcl_SplitPath: mac} {
390
    testsetplatform mac
391
    file split /foo
392
} {foo:}
393
test filename-5.23 {Tcl_SplitPath: mac} {
394
    testsetplatform mac
395
    file split /a/b
396
} {a: b}
397
test filename-5.24 {Tcl_SplitPath: mac} {
398
    testsetplatform mac
399
    file split /a/b/foo
400
} {a: b foo}
401
test filename-5.25 {Tcl_SplitPath: mac} {
402
    testsetplatform mac
403
    file split a/b
404
} {a b}
405
test filename-5.26 {Tcl_SplitPath: mac} {
406
    testsetplatform mac
407
    file split ./foo/bar
408
} {: foo bar}
409
test filename-5.27 {Tcl_SplitPath: mac} {
410
    testsetplatform mac
411
    file split ../foo/bar
412
} {:: foo bar}
413
test filename-5.28 {Tcl_SplitPath: mac} {
414
    testsetplatform mac
415
    file split {}
416
} {}
417
test filename-5.29 {Tcl_SplitPath: mac} {
418
    testsetplatform mac
419
    file split .
420
} {:}
421
test filename-5.30 {Tcl_SplitPath: mac} {
422
    testsetplatform mac
423
    file split ././
424
} {: :}
425
test filename-5.31 {Tcl_SplitPath: mac} {
426
    testsetplatform mac
427
    file split ././.
428
} {: : :}
429
test filename-5.32 {Tcl_SplitPath: mac} {
430
    testsetplatform mac
431
    file split ../
432
} {::}
433
test filename-5.33 {Tcl_SplitPath: mac} {
434
    testsetplatform mac
435
    file split ..
436
} {::}
437
test filename-5.34 {Tcl_SplitPath: mac} {
438
    testsetplatform mac
439
    file split ../..
440
} {:: ::}
441
test filename-5.35 {Tcl_SplitPath: mac} {
442
    testsetplatform mac
443
    file split //foo
444
} {foo:}
445
test filename-5.36 {Tcl_SplitPath: mac} {
446
    testsetplatform mac
447
    file split foo//bar
448
} {foo bar}
449
test filename-5.37 {Tcl_SplitPath: mac} {
450
    testsetplatform mac
451
    file split ~foo
452
} {~foo:}
453
test filename-5.38 {Tcl_SplitPath: mac} {
454
    testsetplatform mac
455
    file split ~
456
} {~:}
457
test filename-5.39 {Tcl_SplitPath: mac} {
458
    testsetplatform mac
459
    file split foo
460
} {foo}
461
test filename-5.40 {Tcl_SplitPath: mac} {
462
    testsetplatform mac
463
    file split ~/
464
} {~:}
465
test filename-5.41 {Tcl_SplitPath: mac} {
466
    testsetplatform mac
467
    file split ~foo/~bar
468
} {~foo: :~bar}
469
test filename-5.42 {Tcl_SplitPath: mac} {
470
    testsetplatform mac
471
    file split ~foo/~bar/~baz
472
} {~foo: :~bar :~baz}
473
test filename-5.43 {Tcl_SplitPath: mac} {
474
    testsetplatform mac
475
    file split foo/bar~/baz
476
} {foo bar~ baz}
477
test filename-5.44 {Tcl_SplitPath: mac} {
478
    testsetplatform mac
479
    file split a/../b
480
} {a :: b}
481
test filename-5.45 {Tcl_SplitPath: mac} {
482
    testsetplatform mac
483
    file split a/../../b
484
} {a :: :: b}
485
test filename-5.46 {Tcl_SplitPath: mac} {
486
    testsetplatform mac
487
    file split a/.././../b
488
} {a :: : :: b}
489
test filename-5.47 {Tcl_SplitPath: mac} {
490
    testsetplatform mac
491
    file split /../bar
492
} {bar:}
493
test filename-5.48 {Tcl_SplitPath: mac} {
494
    testsetplatform mac
495
    file split /./bar
496
} {bar:}
497
test filename-5.49 {Tcl_SplitPath: mac} {
498
    testsetplatform mac
499
    file split //.//.././bar
500
} {bar:}
501
test filename-5.50 {Tcl_SplitPath: mac} {
502
    testsetplatform mac
503
    file split /..
504
} {:/..}
505
test filename-5.51 {Tcl_SplitPath: mac} {
506
    testsetplatform mac
507
    file split //.//.././
508
} {://.//.././}
509
 
510
test filename-6.1 {Tcl_SplitPath: win} {
511
    testsetplatform win
512
    file split /
513
} {/}
514
test filename-6.2 {Tcl_SplitPath: win} {
515
    testsetplatform win
516
    file split /foo
517
} {/ foo}
518
test filename-6.3 {Tcl_SplitPath: win} {
519
    testsetplatform win
520
    file split /foo/bar
521
} {/ foo bar}
522
test filename-6.4 {Tcl_SplitPath: win} {
523
    testsetplatform win
524
    file split /foo/bar/baz
525
} {/ foo bar baz}
526
test filename-6.5 {Tcl_SplitPath: win} {
527
    testsetplatform win
528
    file split foo/bar
529
} {foo bar}
530
test filename-6.6 {Tcl_SplitPath: win} {
531
    testsetplatform win
532
    file split ./foo/bar
533
} {. foo bar}
534
test filename-6.7 {Tcl_SplitPath: win} {
535
    testsetplatform win
536
    file split /foo/../././foo/bar
537
} {/ foo .. . . foo bar}
538
test filename-6.8 {Tcl_SplitPath: win} {
539
    testsetplatform win
540
    file split ../foo/bar
541
} {.. foo bar}
542
test filename-6.9 {Tcl_SplitPath: win} {
543
    testsetplatform win
544
    file split {}
545
} {}
546
test filename-6.10 {Tcl_SplitPath: win} {
547
    testsetplatform win
548
    file split .
549
} {.}
550
test filename-6.11 {Tcl_SplitPath: win} {
551
    testsetplatform win
552
    file split ../
553
} {..}
554
test filename-6.12 {Tcl_SplitPath: win} {
555
    testsetplatform win
556
    file split ../..
557
} {.. ..}
558
test filename-6.13 {Tcl_SplitPath: win} {
559
    testsetplatform win
560
    file split //foo
561
} {/ foo}
562
test filename-6.14 {Tcl_SplitPath: win} {
563
    testsetplatform win
564
    file split foo//bar
565
} {foo bar}
566
test filename-6.15 {Tcl_SplitPath: win} {
567
    testsetplatform win
568
    file split /\\/foo//bar
569
} {//foo/bar}
570
test filename-6.16 {Tcl_SplitPath: win} {
571
    testsetplatform win
572
    file split /\\/foo//bar
573
} {//foo/bar}
574
test filename-6.17 {Tcl_SplitPath: win} {
575
    testsetplatform win
576
    file split /\\/foo//bar
577
} {//foo/bar}
578
test filename-6.18 {Tcl_SplitPath: win} {
579
    testsetplatform win
580
    file split \\\\foo\\bar
581
} {//foo/bar}
582
test filename-6.19 {Tcl_SplitPath: win} {
583
    testsetplatform win
584
    file split \\\\foo\\bar/baz
585
} {//foo/bar baz}
586
test filename-6.20 {Tcl_SplitPath: win} {
587
    testsetplatform win
588
    file split c:/foo
589
} {c:/ foo}
590
test filename-6.21 {Tcl_SplitPath: win} {
591
    testsetplatform win
592
    file split c:foo
593
} {c: foo}
594
test filename-6.22 {Tcl_SplitPath: win} {
595
    testsetplatform win
596
    file split c:
597
} {c:}
598
test filename-6.23 {Tcl_SplitPath: win} {
599
    testsetplatform win
600
    file split c:\\
601
} {c:/}
602
test filename-6.24 {Tcl_SplitPath: win} {
603
    testsetplatform win
604
    file split c:/
605
} {c:/}
606
test filename-6.25 {Tcl_SplitPath: win} {
607
    testsetplatform win
608
    file split c:/./..
609
} {c:/ . ..}
610
test filename-6.26 {Tcl_SplitPath: win} {
611
    testsetplatform win
612
    file split ~foo
613
} {~foo}
614
test filename-6.27 {Tcl_SplitPath: win} {
615
    testsetplatform win
616
    file split ~foo/~bar
617
} {~foo ./~bar}
618
test filename-6.28 {Tcl_SplitPath: win} {
619
    testsetplatform win
620
    file split ~foo/~bar/~baz
621
} {~foo ./~bar ./~baz}
622
test filename-6.29 {Tcl_SplitPath: win} {
623
    testsetplatform win
624
    file split foo/bar~/baz
625
} {foo bar~ baz}
626
test filename-6.30 {Tcl_SplitPath: win} {
627
    testsetplatform win
628
    file split c:~foo
629
} {c: ./~foo}
630
 
631
test filename-7.1 {Tcl_JoinPath: unix} {
632
    testsetplatform unix
633
    file join / a
634
} {/a}
635
test filename-7.2 {Tcl_JoinPath: unix} {
636
    testsetplatform unix
637
    file join a b
638
} {a/b}
639
test filename-7.3 {Tcl_JoinPath: unix} {
640
    testsetplatform unix
641
    file join /a c /b d
642
} {/b/d}
643
test filename-7.4 {Tcl_JoinPath: unix} {
644
    testsetplatform unix
645
    file join /
646
} {/}
647
test filename-7.5 {Tcl_JoinPath: unix} {
648
    testsetplatform unix
649
    file join a
650
} {a}
651
test filename-7.6 {Tcl_JoinPath: unix} {
652
    testsetplatform unix
653
    file join {}
654
} {}
655
test filename-7.7 {Tcl_JoinPath: unix} {
656
    testsetplatform unix
657
    file join /a/ b
658
} {/a/b}
659
test filename-7.8 {Tcl_JoinPath: unix} {
660
    testsetplatform unix
661
    file join /a// b
662
} {/a/b}
663
test filename-7.9 {Tcl_JoinPath: unix} {
664
    testsetplatform unix
665
    file join /a/./../. b
666
} {/a/./.././b}
667
test filename-7.10 {Tcl_JoinPath: unix} {
668
    testsetplatform unix
669
    file join ~ a
670
} {~/a}
671
test filename-7.11 {Tcl_JoinPath: unix} {
672
    testsetplatform unix
673
    file join ~a ~b
674
} {~b}
675
test filename-7.12 {Tcl_JoinPath: unix} {
676
    testsetplatform unix
677
    file join ./~a b
678
} {./~a/b}
679
test filename-7.13 {Tcl_JoinPath: unix} {
680
    testsetplatform unix
681
    file join ./~a ~b
682
} {~b}
683
test filename-7.14 {Tcl_JoinPath: unix} {
684
    testsetplatform unix
685
    file join ./~a ./~b
686
} {./~a/~b}
687
test filename-7.15 {Tcl_JoinPath: unix} {
688
    testsetplatform unix
689
    file join a . b
690
} {a/./b}
691
test filename-7.16 {Tcl_JoinPath: unix} {
692
    testsetplatform unix
693
    file join a . ./~b
694
} {a/./~b}
695
test filename-7.17 {Tcl_JoinPath: unix} {
696
    testsetplatform unix
697
    file join //a b
698
} {/a/b}
699
test filename-7.18 {Tcl_JoinPath: unix} {
700
    testsetplatform unix
701
    file join /// a b
702
} {/a/b}
703
 
704
test filename-8.1 {Tcl_JoinPath: mac} {
705
    testsetplatform mac
706
    file join a b
707
} {:a:b}
708
test filename-8.2 {Tcl_JoinPath: mac} {
709
    testsetplatform mac
710
    file join :a b
711
} {:a:b}
712
test filename-8.3 {Tcl_JoinPath: mac} {
713
    testsetplatform mac
714
    file join a b:
715
} {b:}
716
test filename-8.4 {Tcl_JoinPath: mac} {
717
    testsetplatform mac
718
    file join a: :b
719
} {a:b}
720
test filename-8.5 {Tcl_JoinPath: mac} {
721
    testsetplatform mac
722
    file join a: :b:
723
} {a:b}
724
test filename-8.6 {Tcl_JoinPath: mac} {
725
    testsetplatform mac
726
    file join a :: b
727
} {:a::b}
728
test filename-8.7 {Tcl_JoinPath: mac} {
729
    testsetplatform mac
730
    file join a :: :: b
731
} {:a:::b}
732
test filename-8.8 {Tcl_JoinPath: mac} {
733
    testsetplatform mac
734
    file join a ::: b
735
} {:a:::b}
736
test filename-8.9 {Tcl_JoinPath: mac} {
737
    testsetplatform mac
738
    file join a: b:
739
} {b:}
740
test filename-8.10 {Tcl_JoinPath: mac} {
741
    testsetplatform mac
742
    file join /a/b
743
} {a:b}
744
test filename-8.11 {Tcl_JoinPath: mac} {
745
    testsetplatform mac
746
    file join /a/b c/d
747
} {a:b:c:d}
748
test filename-8.12 {Tcl_JoinPath: mac} {
749
    testsetplatform mac
750
    file join /a/b :c:d
751
} {a:b:c:d}
752
test filename-8.13 {Tcl_JoinPath: mac} {
753
    testsetplatform mac
754
    file join ~ foo
755
} {~:foo}
756
test filename-8.14 {Tcl_JoinPath: mac} {
757
    testsetplatform mac
758
    file join :: ::
759
} {:::}
760
test filename-8.15 {Tcl_JoinPath: mac} {
761
    testsetplatform mac
762
    file join a: ::
763
} {a::}
764
test filename-8.16 {Tcl_JoinPath: mac} {
765
    testsetplatform mac
766
    file join a {} b
767
} {:a:b}
768
test filename-8.17 {Tcl_JoinPath: mac} {
769
    testsetplatform mac
770
    file join a::: b
771
} {a:::b}
772
test filename-8.18 {Tcl_JoinPath: mac} {
773
    testsetplatform mac
774
    file join a : : :
775
} {:a}
776
test filename-8.19 {Tcl_JoinPath: mac} {
777
    testsetplatform mac
778
    file join :
779
} {:}
780
test filename-8.20 {Tcl_JoinPath: mac} {
781
    testsetplatform mac
782
    file join : a
783
} {:a}
784
test filename-8.21 {Tcl_JoinPath: mac} {
785
    testsetplatform mac
786
    file join a: :b/c
787
} {a:b/c}
788
test filename-8.22 {Tcl_JoinPath: mac} {
789
    testsetplatform mac
790
    file join :a :b/c
791
} {:a:b/c}
792
 
793
test filename-9.1 {Tcl_JoinPath: win} {
794
    testsetplatform win
795
    file join a b
796
} {a/b}
797
test filename-9.2 {Tcl_JoinPath: win} {
798
    testsetplatform win
799
    file join /a b
800
} {/a/b}
801
test filename-9.3 {Tcl_JoinPath: win} {
802
    testsetplatform win
803
    file join /a /b
804
} {/b}
805
test filename-9.4 {Tcl_JoinPath: win} {
806
    testsetplatform win
807
    file join c: foo
808
} {c:foo}
809
test filename-9.5 {Tcl_JoinPath: win} {
810
    testsetplatform win
811
    file join c:/ foo
812
} {c:/foo}
813
test filename-9.6 {Tcl_JoinPath: win} {
814
    testsetplatform win
815
    file join c:\\bar foo
816
} {c:/bar/foo}
817
test filename-9.7 {Tcl_JoinPath: win} {
818
    testsetplatform win
819
    file join /foo c:bar
820
} {c:bar}
821
test filename-9.8 {Tcl_JoinPath: win} {
822
    testsetplatform win
823
    file join ///host//share dir
824
} {//host/share/dir}
825
test filename-9.9 {Tcl_JoinPath: win} {
826
    testsetplatform win
827
    file join ~ foo
828
} {~/foo}
829
test filename-9.10 {Tcl_JoinPath: win} {
830
    testsetplatform win
831
    file join ~/~foo
832
} {~/~foo}
833
test filename-9.11 {Tcl_JoinPath: win} {
834
    testsetplatform win
835
    file join ~ ./~foo
836
} {~/~foo}
837
test filename-9.12 {Tcl_JoinPath: win} {
838
    testsetplatform win
839
    file join / ~foo
840
} {~foo}
841
test filename-9.13 {Tcl_JoinPath: win} {
842
    testsetplatform win
843
    file join ./a/ b c
844
} {./a/b/c}
845
test filename-9.14 {Tcl_JoinPath: win} {
846
    testsetplatform win
847
    file join ./~a/ b c
848
} {./~a/b/c}
849
test filename-9.15 {Tcl_JoinPath: win} {
850
    testsetplatform win
851
    file join // host share path
852
} {/host/share/path}
853
test filename-9.16 {Tcl_JoinPath: win} {
854
    testsetplatform win
855
    file join foo . bar
856
} {foo/./bar}
857
test filename-9.17 {Tcl_JoinPath: win} {
858
    testsetplatform win
859
    file join foo .. bar
860
} {foo/../bar}
861
test filename-9.18 {Tcl_JoinPath: win} {
862
    testsetplatform win
863
    file join foo/./bar
864
} {foo/./bar}
865
 
866
test filename-10.1 {Tcl_TranslateFileName} {
867
    testsetplatform unix
868
    list [catch {testtranslatefilename foo} msg] $msg
869
} {0 foo}
870
test filename-10.2 {Tcl_TranslateFileName} {
871
    testsetplatform windows
872
    list [catch {testtranslatefilename {c:/foo}} msg] $msg
873
} {0 {c:\foo}}
874
test filename-10.3 {Tcl_TranslateFileName} {
875
    testsetplatform windows
876
    list [catch {testtranslatefilename {c:/\\foo/}} msg] $msg
877
} {0 {c:\foo}}
878
test filename-10.4 {Tcl_TranslateFileName} {
879
    testsetplatform mac
880
    list [catch {testtranslatefilename foo} msg] $msg
881
} {0 :foo}
882
test filename-10.5 {Tcl_TranslateFileName} {
883
    testsetplatform mac
884
    list [catch {testtranslatefilename :~foo} msg] $msg
885
} {0 :~foo}
886
test filename-10.6 {Tcl_TranslateFileName} {
887
    global env
888
    set temp $env(HOME)
889
    set env(HOME) "/home/test"
890
    testsetplatform unix
891
    set result [list [catch {testtranslatefilename ~/foo} msg] $msg]
892
    set env(HOME) $temp
893
    set result
894
} {0 /home/test/foo}
895
test filename-10.7 {Tcl_TranslateFileName} {
896
    global env
897
    set temp $env(HOME)
898
    unset env(HOME)
899
    testsetplatform unix
900
    set result [list [catch {testtranslatefilename ~/foo} msg] $msg]
901
    set env(HOME) $temp
902
    set result
903
} {1 {couldn't find HOME environment variable to expand path}}
904
test filename-10.8 {Tcl_TranslateFileName} {
905
    global env
906
    set temp $env(HOME)
907
    set env(HOME) "/home/test"
908
    testsetplatform unix
909
    set result [list [catch {testtranslatefilename ~} msg] $msg]
910
    set env(HOME) $temp
911
    set result
912
} {0 /home/test}
913
test filename-10.9 {Tcl_TranslateFileName} {
914
    global env
915
    set temp $env(HOME)
916
    set env(HOME) "/home/test/"
917
    testsetplatform unix
918
    set result [list [catch {testtranslatefilename ~} msg] $msg]
919
    set env(HOME) $temp
920
    set result
921
} {0 /home/test}
922
test filename-10.10 {Tcl_TranslateFileName} {
923
    global env
924
    set temp $env(HOME)
925
    set env(HOME) "/home/test/"
926
    testsetplatform unix
927
    set result [list [catch {testtranslatefilename ~/foo} msg] $msg]
928
    set env(HOME) $temp
929
    set result
930
} {0 /home/test/foo}
931
test filename-10.11 {Tcl_TranslateFileName} {
932
    global env
933
    set temp $env(HOME)
934
    set env(HOME) "Root:"
935
    testsetplatform mac
936
    set result [list [catch {testtranslatefilename ~/foo} msg] $msg]
937
    set env(HOME) $temp
938
    set result
939
} {0 Root:foo}
940
test filename-10.12 {Tcl_TranslateFileName} {
941
    global env
942
    set temp $env(HOME)
943
    set env(HOME) "Root:home"
944
    testsetplatform mac
945
    set result [list [catch {testtranslatefilename ~/foo} msg] $msg]
946
    set env(HOME) $temp
947
    set result
948
} {0 Root:home:foo}
949
test filename-10.13 {Tcl_TranslateFileName} {
950
    global env
951
    set temp $env(HOME)
952
    set env(HOME) "Root:home"
953
    testsetplatform mac
954
    set result [list [catch {testtranslatefilename ~::foo} msg] $msg]
955
    set env(HOME) $temp
956
    set result
957
} {0 Root:home::foo}
958
test filename-10.14 {Tcl_TranslateFileName} {
959
    global env
960
    set temp $env(HOME)
961
    set env(HOME) "Root:home"
962
    testsetplatform mac
963
    set result [list [catch {testtranslatefilename ~} msg] $msg]
964
    set env(HOME) $temp
965
    set result
966
} {0 Root:home}
967
test filename-10.15 {Tcl_TranslateFileName} {
968
    global env
969
    set temp $env(HOME)
970
    set env(HOME) "Root:home:"
971
    testsetplatform mac
972
    set result [list [catch {testtranslatefilename ~::foo} msg] $msg]
973
    set env(HOME) $temp
974
    set result
975
} {0 Root:home::foo}
976
test filename-10.16 {Tcl_TranslateFileName} {
977
    global env
978
    set temp $env(HOME)
979
    set env(HOME) "Root:home::"
980
    testsetplatform mac
981
    set result [list [catch {testtranslatefilename ~::foo} msg] $msg]
982
    set env(HOME) $temp
983
    set result
984
} {0 Root:home:::foo}
985
test filename-10.17 {Tcl_TranslateFileName} {
986
    global env
987
    set temp $env(HOME)
988
    set env(HOME) "\\home\\"
989
    testsetplatform windows
990
    set result [list [catch {testtranslatefilename ~/foo} msg] $msg]
991
    set env(HOME) $temp
992
    set result
993
} {0 {\home\foo}}
994
test filename-10.18 {Tcl_TranslateFileName} {
995
    global env
996
    set temp $env(HOME)
997
    set env(HOME) "\\home\\"
998
    testsetplatform windows
999
    set result [list [catch {testtranslatefilename ~/foo\\bar} msg] $msg]
1000
    set env(HOME) $temp
1001
    set result
1002
} {0 {\home\foo\bar}}
1003
test filename-10.19 {Tcl_TranslateFileName} {
1004
    global env
1005
    set temp $env(HOME)
1006
    set env(HOME) "c:"
1007
    testsetplatform windows
1008
    set result [list [catch {testtranslatefilename ~/foo} msg] $msg]
1009
    set env(HOME) $temp
1010
    set result
1011
} {0 c:foo}
1012
test filename-10.20 {Tcl_TranslateFileName} {
1013
    list [catch {testtranslatefilename ~blorp/foo} msg] $msg
1014
} {1 {user "blorp" doesn't exist}}
1015
test filename-10.21 {Tcl_TranslateFileName} {
1016
    global env
1017
    set temp $env(HOME)
1018
    set env(HOME) "c:\\"
1019
    testsetplatform windows
1020
    set result [list [catch {testtranslatefilename ~/foo} msg] $msg]
1021
    set env(HOME) $temp
1022
    set result
1023
} {0 {c:\foo}}
1024
test filename-10.22 {Tcl_TranslateFileName} {
1025
    testsetplatform windows
1026
    list [catch {testtranslatefilename foo//bar} msg] $msg
1027
} {0 {foo\bar}}
1028
 
1029
testsetplatform $platform
1030
 
1031
test filename-10.23 {Tcl_TranslateFileName} {nonPortable unixOnly} {
1032
    # this test fails if ~ouster is not /home/ouster
1033
    list [catch {testtranslatefilename ~ouster} msg] $msg
1034
} {0 /home/ouster}
1035
test filename-10.24 {Tcl_TranslateFileName} {nonPortable unixOnly} {
1036
    # this test fails if ~ouster is not /home/ouster
1037
    list [catch {testtranslatefilename ~ouster/foo} msg] $msg
1038
} {0 /home/ouster/foo}
1039
 
1040
 
1041
test filename-11.1 {Tcl_GlobCmd} {
1042
    list [catch {glob} msg] $msg
1043
} {1 {wrong # args: should be "glob ?switches? name ?name ...?"}}
1044
test filename-11.2 {Tcl_GlobCmd} {
1045
    list [catch {glob -gorp} msg] $msg
1046
} {1 {bad switch "-gorp": must be -nocomplain or --}}
1047
test filename-11.3 {Tcl_GlobCmd} {
1048
    list [catch {glob -nocomplai} msg] $msg
1049
} {1 {bad switch "-nocomplai": must be -nocomplain or --}}
1050
test filename-11.4 {Tcl_GlobCmd} {
1051
    list [catch {glob -nocomplain} msg] $msg
1052
} {1 {wrong # args: should be "glob ?switches? name ?name ...?"}}
1053
test filename-11.5 {Tcl_GlobCmd} {
1054
    list [catch {glob -nocomplain ~xyqrszzz} msg] $msg
1055
} {0 {}}
1056
test filename-11.6 {Tcl_GlobCmd} {
1057
    list [catch {glob ~xyqrszzz} msg] $msg
1058
} {1 {user "xyqrszzz" doesn't exist}}
1059
test filename-11.7 {Tcl_GlobCmd} {
1060
    list [catch {glob -- -nocomplain} msg] $msg
1061
} {1 {no files matched glob patterns "-nocomplain"}}
1062
test filename-11.8 {Tcl_GlobCmd} {
1063
    list [catch {glob -nocomplain -- -nocomplain} msg] $msg
1064
} {0 {}}
1065
test filename-11.9 {Tcl_GlobCmd} {
1066
    testsetplatform unix
1067
    list [catch {glob ~\\xyqrszzz/bar} msg] $msg
1068
} {1 {globbing characters not supported in user names}}
1069
test filename-11.10 {Tcl_GlobCmd} {
1070
    testsetplatform unix
1071
    list [catch {glob -nocomplain ~\\xyqrszzz/bar} msg] $msg
1072
} {0 {}}
1073
test filename-11.11 {Tcl_GlobCmd} {
1074
    testsetplatform unix
1075
    list [catch {glob ~xyqrszzz\\/\\bar} msg] $msg
1076
} {1 {user "xyqrszzz" doesn't exist}}
1077
test filename-11.12 {Tcl_GlobCmd} {
1078
    testsetplatform unix
1079
    set home $env(HOME)
1080
    unset env(HOME)
1081
    set x [list [catch {glob ~/*} msg] $msg]
1082
    set env(HOME) $home
1083
    set x
1084
} {1 {couldn't find HOME environment variable to expand path}}
1085
 
1086
testsetplatform $platform
1087
 
1088
test filename-11.13 {Tcl_GlobCmd} {
1089
    list [catch {file join [lindex [glob ~] 0]} msg] $msg
1090
} [list 0 [file join $env(HOME)]]
1091
 
1092
set oldhome $env(HOME)
1093
set env(HOME) [pwd]
1094
file delete -force globTest
1095
file mkdir globTest/a1/b1
1096
file mkdir globTest/a1/b2
1097
file mkdir globTest/a2/b3
1098
file mkdir globTest/a3
1099
close [open globTest/x1.c w]
1100
close [open globTest/y1.c w]
1101
close [open globTest/z1.c w]
1102
close [open "globTest/weird name.c" w]
1103
close [open globTest/a1/b1/x2.c w]
1104
close [open globTest/a1/b2/y2.c w]
1105
 
1106
# Cannot create a file with the following names under Win32s.  We have to
1107
# skip the tests that are checking the difference between a "." or "," in
1108
# the file name vs. a "." or "," in the glob pattern.
1109
 
1110
catch {close [open globTest/.1 w]}
1111
catch {close [open globTest/x,z1.c w]}
1112
 
1113
test filename-11.14 {Tcl_GlobCmd} {
1114
    list [catch {glob ~/globTest} msg] $msg
1115
} [list 0 [list [file join $env(HOME) globTest]]]
1116
test filename-11.15 {Tcl_GlobCmd} {
1117
    list [catch {glob ~\\/globTest} msg] $msg
1118
} [list 0 [list [file join $env(HOME) globTest]]]
1119
test filename-11.16 {Tcl_GlobCmd} {
1120
    list [catch {glob globTest} msg] $msg
1121
} {0 globTest}
1122
 
1123
test filename-12.1 {simple globbing} {unixOrPc} {
1124
    list [catch {glob {}} msg] $msg
1125
} {0 .}
1126
test filename-12.2 {simple globbing} {macOnly} {
1127
    list [catch {glob {}} msg] $msg
1128
} {0 :}
1129
test filename-12.3 {simple globbing} {
1130
    list [catch {glob -nocomplain \{a1,a2\}} msg] $msg
1131
} {0 {}}
1132
 
1133
if {$tcl_platform(platform) == "macintosh"} {
1134
  set globPreResult :globTest:
1135
} else {
1136
  set globPreResult globTest/
1137
}
1138
set x1 x1.c
1139
set y1 y1.c
1140
test filename-12.4 {simple globbing} {unixOrPc} {
1141
    lsort [glob globTest/x1.c globTest/y1.c globTest/foo]
1142
} "$globPreResult$x1 $globPreResult$y1"
1143
test filename-12.5 {simple globbing} {
1144
    list [catch {glob globTest\\/x1.c} msg] $msg
1145
} "0 $globPreResult$x1"
1146
test filename-12.6 {simple globbing} {
1147
    list [catch {glob globTest\\/\\x1.c} msg] $msg
1148
} "0 $globPreResult$x1"
1149
 
1150
test filename-13.1 {globbing with brace substitution} {
1151
    list [catch {glob globTest/\{\}} msg] $msg
1152
} "0 $globPreResult"
1153
test filename-13.2 {globbing with brace substitution} {
1154
    list [catch {glob globTest/\{} msg] $msg
1155
} {1 {unmatched open-brace in file name}}
1156
test filename-13.3 {globbing with brace substitution} {
1157
    list [catch {glob globTest/\{\\\}} msg] $msg
1158
} {1 {unmatched open-brace in file name}}
1159
test filename-13.4 {globbing with brace substitution} {
1160
    list [catch {glob globTest/\{\\} msg] $msg
1161
} {1 {unmatched open-brace in file name}}
1162
test filename-13.5 {globbing with brace substitution} {
1163
    list [catch {glob globTest/\}} msg] $msg
1164
} {1 {unmatched close-brace in file name}}
1165
test filename-13.6 {globbing with brace substitution} {
1166
    list [catch {glob globTest/\{\}x1.c} msg] $msg
1167
} "0 $globPreResult$x1"
1168
test filename-13.7 {globbing with brace substitution} {
1169
    list [catch {glob globTest/\{x\}1.c} msg] $msg
1170
} "0 $globPreResult$x1"
1171
test filename-13.8 {globbing with brace substitution} {
1172
    list [catch {glob globTest/\{x\{\}\}1.c} msg] $msg
1173
} "0 $globPreResult$x1"
1174
test filename-13.9 {globbing with brace substitution} {!win32s} {
1175
    list [lsort [catch {glob globTest/\{x,y\}1.c} msg]] $msg
1176
} [list 0 [list $globPreResult$x1 $globPreResult$y1]]
1177
test filename-13.10 {globbing with brace substitution} {!win32s} {
1178
    list [lsort [catch {glob globTest/\{x,,y\}1.c} msg]] $msg
1179
} [list 0 [list $globPreResult$x1 $globPreResult$y1]]
1180
test filename-13.11 {globbing with brace substitution} {unixOrPc && !win32s} {
1181
    list [lsort [catch {glob globTest/\{x,x\\,z,z\}1.c} msg]] $msg
1182
} {0 {globTest/x1.c globTest/x,z1.c globTest/z1.c}}
1183
test filename-13.12 {globbing with brace substitution} {macOnly} {
1184
    list [lsort [catch {glob globTest/\{x,x\\,z,z\}1.c} msg]] $msg
1185
} {0 {:globTest:x1.c :globTest:x,z1.c :globTest:z1.c}}
1186
test filename-13.13 {globbing with brace substitution} {
1187
    lsort [glob globTest/{a,b,x,y}1.c]
1188
} [list $globPreResult$x1 $globPreResult$y1]
1189
test filename-13.14 {globbing with brace substitution} {unixOrPc} {
1190
    lsort [glob {globTest/{x1,y2,weird name}.c}]
1191
} {{globTest/weird name.c} globTest/x1.c}
1192
test filename-13.15 {globbing with brace substitution} {macOnly} {
1193
    lsort [glob {globTest/{x1,y2,weird name}.c}]
1194
} {{:globTest:weird name.c} :globTest:x1.c}
1195
test filename-13.16 {globbing with brace substitution} {unixOrPc} {
1196
    lsort [glob globTest/{x1.c,a1/*}]
1197
} {globTest/a1/b1 globTest/a1/b2 globTest/x1.c}
1198
test filename-13.17 {globbing with brace substitution} {macOnly} {
1199
    lsort [glob globTest/{x1.c,a1/*}]
1200
} {:globTest:a1:b1 :globTest:a1:b2 :globTest:x1.c}
1201
test filename-13.18 {globbing with brace substitution} {unixOrPc} {
1202
    lsort [glob globTest/{x1.c,{a},a1/*}]
1203
} {globTest/a1/b1 globTest/a1/b2 globTest/x1.c}
1204
test filename-13.19 {globbing with brace substitution} {macOnly} {
1205
    lsort [glob globTest/{x1.c,{a},a1/*}]
1206
} {:globTest:a1:b1 :globTest:a1:b2 :globTest:x1.c}
1207
test filename-13.20 {globbing with brace substitution} {unixOrPc} {
1208
    lsort [glob globTest/{a,x}1/*/{x,y}*]
1209
} {globTest/a1/b1/x2.c globTest/a1/b2/y2.c}
1210
test filename-13.21 {globbing with brace substitution} {macOnly} {
1211
    lsort [glob globTest/{a,x}1/*/{x,y}*]
1212
} {:globTest:a1:b1:x2.c :globTest:a1:b2:y2.c}
1213
test filename-13.22 {globbing with brace substitution} {
1214
    list [catch {glob globTest/\{a,x\}1/*/\{} msg] $msg
1215
} {1 {unmatched open-brace in file name}}
1216
 
1217
test filename-14.1 {asterisks, question marks, and brackets} {unixOrPc && !win32s} {
1218
    lsort [glob g*/*.c]
1219
} {{globTest/weird name.c} globTest/x,z1.c globTest/x1.c globTest/y1.c globTest/z1.c}
1220
test filename-14.1 {asterisks, question marks, and brackets} {win32s} {
1221
    lsort [glob g*/*.c]
1222
} {globtest/weirdn~1.c globtest/x1.c globtest/y1.c globtest/z1.c}
1223
test filename-14.2 {asterisks, question marks, and brackets} {macOnly} {
1224
    lsort [glob g*/*.c]
1225
} {{:globTest:weird name.c} :globTest:x,z1.c :globTest:x1.c :globTest:y1.c :globTest:z1.c}
1226
test filename-14.3 {asterisks, question marks, and brackets} {unixOrPc} {
1227
    lsort [glob globTest/?1.c]
1228
} {globTest/x1.c globTest/y1.c globTest/z1.c}
1229
test filename-14.4 {asterisks, question marks, and brackets} {macOnly} {
1230
    lsort [glob globTest/?1.c]
1231
} {:globTest:x1.c :globTest:y1.c :globTest:z1.c}
1232
test filename-14.5 {asterisks, question marks, and brackets} {unixOrPc && !win32s} {
1233
    lsort [glob */*/*/*.c]
1234
} {globTest/a1/b1/x2.c globTest/a1/b2/y2.c}
1235
test filename-14.5 {asterisks, question marks, and brackets} {win32s} {
1236
    lsort [glob */*/*/*.c]
1237
} {globtest/a1/b1/x2.c globtest/a1/b2/y2.c}
1238
test filename-14.6 {asterisks, question marks, and brackets} {macOnly} {
1239
    lsort [glob */*/*/*.c]
1240
} {:globTest:a1:b1:x2.c :globTest:a1:b2:y2.c}
1241
test filename-14.7 {asterisks, question marks, and brackets} {unixOrPc && !win32s} {
1242
    lsort [glob globTest/*]
1243
} {globTest/a1 globTest/a2 globTest/a3 {globTest/weird name.c} globTest/x,z1.c globTest/x1.c globTest/y1.c globTest/z1.c}
1244
test filename-14.7 {asterisks, question marks, and brackets} {win32s} {
1245
    lsort [glob globTest/*]
1246
} {globTest/a1 globTest/a2 globTest/a3 globTest/weirdn~1.c globTest/x1.c globTest/y1.c globTest/z1.c}
1247
test filename-14.8 {asterisks, question marks, and brackets} {macOnly} {
1248
    lsort [glob globTest/*]
1249
} {:globTest:.1 :globTest:a1 :globTest:a2 :globTest:a3 {:globTest:weird name.c} :globTest:x,z1.c :globTest:x1.c :globTest:y1.c :globTest:z1.c}
1250
test filename-14.9 {asterisks, question marks, and brackets} {unixOrPc && !win32s} {
1251
    lsort [glob globTest/.*]
1252
} {globTest/. globTest/.. globTest/.1}
1253
test filename-14.9 {asterisks, question marks, and brackets} {win32s} {
1254
    lsort [glob globTest/.*]
1255
} {globTest/. globTest/..}
1256
test filename-14.10 {asterisks, question marks, and brackets} {macOnly} {
1257
    lsort [glob globTest/.*]
1258
} {:globTest:.1}
1259
test filename-14.11 {asterisks, question marks, and brackets} {unixOrPc} {
1260
    lsort [glob globTest/*/*]
1261
} {globTest/a1/b1 globTest/a1/b2 globTest/a2/b3}
1262
test filename-14.12 {asterisks, question marks, and brackets} {macOnly} {
1263
    lsort [glob globTest/*/*]
1264
} {:globTest:a1:b1 :globTest:a1:b2 :globTest:a2:b3}
1265
test filename-14.13 {asterisks, question marks, and brackets} {unixOrPc} {
1266
    lsort [glob {globTest/[xyab]1.*}]
1267
} {globTest/x1.c globTest/y1.c}
1268
test filename-14.14 {asterisks, question marks, and brackets} {macOnly} {
1269
    lsort [glob {globTest/[xyab]1.*}]
1270
} {:globTest:x1.c :globTest:y1.c}
1271
test filename-14.15 {asterisks, question marks, and brackets} {unixOrPc} {
1272
    lsort [glob globTest/*/]
1273
} {globTest/a1/ globTest/a2/ globTest/a3/}
1274
test filename-14.16 {asterisks, question marks, and brackets} {macOnly} {
1275
    lsort [glob globTest/*/]
1276
} {:globTest:a1: :globTest:a2: :globTest:a3:}
1277
test filename-14.17 {asterisks, question marks, and brackets} {
1278
    global env
1279
    set temp $env(HOME)
1280
    set env(HOME) [file join $env(HOME) globTest]
1281
    set result [list [catch {glob ~/z*} msg] $msg]
1282
    set env(HOME) $temp
1283
    set result
1284
} [list 0 [list [file join $env(HOME) globTest z1.c]]]
1285
test filename-14.18 {asterisks, question marks, and brackets} {unixOrPc && !win32s} {
1286
    list [catch {lsort [glob globTest/*.c goo/*]} msg] $msg
1287
} {0 {{globTest/weird name.c} globTest/x,z1.c globTest/x1.c globTest/y1.c globTest/z1.c}}
1288
test filename-14.18 {asterisks, question marks, and brackets} {win32s} {
1289
    list [catch {lsort [glob globTest/*.c goo/*]} msg] $msg
1290
} {0 {globTest/weirdn~1.c globTest/x1.c globTest/y1.c globTest/z1.c}}
1291
test filename-14.19 {asterisks, question marks, and brackets} {macOnly} {
1292
    list [catch {lsort [glob globTest/*.c goo/*]} msg] $msg
1293
} {0 {{:globTest:weird name.c} :globTest:x,z1.c :globTest:x1.c :globTest:y1.c :globTest:z1.c}}
1294
test filename-14.20 {asterisks, question marks, and brackets} {
1295
    list [catch {glob -nocomplain goo/*} msg] $msg
1296
} {0 {}}
1297
test filename-14.21 {asterisks, question marks, and brackets} {
1298
    list [catch {glob globTest/*/gorp} msg] $msg
1299
} {1 {no files matched glob pattern "globTest/*/gorp"}}
1300
test filename-14.22 {asterisks, question marks, and brackets} {
1301
    list [catch {glob goo/* x*z foo?q} msg] $msg
1302
} {1 {no files matched glob patterns "goo/* x*z foo?q"}}
1303
test filename-14.23 {slash globbing} {unixOrPc} {
1304
    glob /
1305
} /
1306
test filename-14.24 {slash globbing} {pcOnly} {
1307
    glob {\\}
1308
} /
1309
 
1310
# The following tests are only valid for Unix systems.
1311
 
1312
if {$tcl_platform(platform) == "unix"} {
1313
    # On some systems, like AFS, "000" protection doesn't prevent
1314
    # access by owner, so the following test is not portable.
1315
 
1316
    exec chmod 000 globTest/a1
1317
    test filename-15.1 {unix specific globbing} {nonPortable} {
1318
        string tolower [list [catch {glob globTest/a1/*} msg]  $msg $errorCode]
1319
    } {1 {couldn't read directory "globtest/a1": permission denied} {posix eacces {permission denied}}}
1320
    test filename-15.2 {unix specific no complain: no errors} {nonPortable} {
1321
        glob -nocomplain globTest/a1/*
1322
    } {}
1323
    test filename-15.3 {unix specific no complain: no errors, good result} {nonPortable knownBug} {
1324
        # test fails because if an error occur , the interp's result
1325
        # is reset...
1326
        glob -nocomplain globTest/a2 globTest/a1/* globTest/a3
1327
    } {globTest/a2 globTest/a3}
1328
    exec chmod 755 globTest/a1
1329
    test filename-15.4 {unix specific no complain: no errors, good result} {nonPortable knownBug} {
1330
        # test fails because if an error occur , the interp's result
1331
        # is reset... (or you don't run at sunscript where the
1332
        # outser and demailly's users exists
1333
        glob -nocomplain ~ouster ~foo ~demailly
1334
    } {/home/ouster /home/demailly}
1335
    test filename-15.5 {unix specific globbing} {nonPortable} {
1336
        glob ~ouster/.csh*
1337
    } "/home/ouster/.cshrc"
1338
    close [open globTest/odd\\\[\]*?\{\}name w]
1339
    test filename-15.6 {unix specific globbing} {
1340
        global env
1341
        set temp $env(HOME)
1342
        set env(HOME) $env(HOME)/globTest/odd\\\[\]*?\{\}name
1343
        set result [list [catch {glob ~} msg] $msg]
1344
        set env(HOME) $temp
1345
        set result
1346
    } [list 0 [list [glob ~]/globTest/odd\\\[\]*?\{\}name]]
1347
    exec rm -f globTest/odd\\\[\]*?\{\}name
1348
}
1349
 
1350
# The following tests are only valid for Windows systems.
1351
 
1352
if {$tcl_platform(platform) == "windows"} {
1353
    set temp [pwd]
1354
    cd c:/
1355
    catch {
1356
        removeDirectory globTest
1357
        makeDirectory globTest
1358
        close [open globTest/x1.BAT w]
1359
        close [open globTest/y1.Bat w]
1360
        close [open globTest/z1.bat w]
1361
    }
1362
 
1363
    test filename-16.1 {windows specific globbing} {!win32s} {
1364
        lsort [glob globTest/*.bat]
1365
    } {globTest/x1.BAT globTest/y1.Bat globTest/z1.bat}
1366
    test filename-16.1 {windows specific globbing} {win32s} {
1367
        lsort [glob globTest/*.bat]
1368
    } {globTest/x1.bat globTest/y1.bat globTest/z1.bat}
1369
    test filename-16.2 {windows specific globbing} {
1370
        glob c:
1371
    } c:
1372
    test filename-16.3 {windows specific globbing} {
1373
        glob c:\\\\
1374
        } c:/
1375
    test filename-16.4 {windows specific globbing} {
1376
        glob c:/
1377
    } c:/
1378
    test filename-16.5 {windows specific globbing} {!win32s} {
1379
        glob c:*Test
1380
    } c:globTest
1381
    test filename-16.5 {windows specific globbing} {win32s} {
1382
        glob c:*Test
1383
    } c:globtest
1384
    test filename-16.6 {windows specific globbing} {!win32s} {
1385
        glob c:\\\\*Test
1386
    } c:/globTest
1387
    test filename-16.6 {windows specific globbing} {win32s} {
1388
        glob c:\\\\*Test
1389
    } c:/globtest
1390
    test filename-16.7 {windows specific globbing} {!win32s} {
1391
        glob c:/*Test
1392
    } c:/globTest
1393
    test filename-16.7 {windows specific globbing} {win32s} {
1394
        glob c:/*Test
1395
    } c:/globtest
1396
    test filename-16.8 {windows specific globbing} {!win32s} {
1397
        lsort [glob c:globTest/*.bat]
1398
    } {c:globTest/x1.BAT c:globTest/y1.Bat c:globTest/z1.bat}
1399
    test filename-16.8 {windows specific globbing} {win32s} {
1400
        lsort [glob c:globTest/*.bat]
1401
    } {c:globTest/x1.bat c:globTest/y1.bat c:globTest/z1.bat}
1402
    test filename-16.9 {windows specific globbing} {!win32s} {
1403
        lsort [glob c:/globTest/*.bat]
1404
    } {c:/globTest/x1.BAT c:/globTest/y1.Bat c:/globTest/z1.bat}
1405
    test filename-16.9 {windows specific globbing} {win32s} {
1406
        lsort [glob c:/globTest/*.bat]
1407
    } {c:/globTest/x1.bat c:/globTest/y1.bat c:/globTest/z1.bat}
1408
    test filename-16.10 {windows specific globbing} {!win32s} {
1409
        lsort [glob c:globTest\\\\*.bat]
1410
    } {c:globTest/x1.BAT c:globTest/y1.Bat c:globTest/z1.bat}
1411
    test filename-16.10 {windows specific globbing} {win32s} {
1412
        lsort [glob c:globTest\\\\*.bat]
1413
    } {c:globTest/x1.bat c:globTest/y1.bat c:globTest/z1.bat}
1414
    test filename-16.11 {windows specific globbing} {!win32s} {
1415
        lsort [glob c:\\\\globTest\\\\*.bat]
1416
    } {c:/globTest/x1.BAT c:/globTest/y1.Bat c:/globTest/z1.bat}
1417
    test filename-16.11 {windows specific globbing} {win32s} {
1418
        lsort [glob c:\\\\globTest\\\\*.bat]
1419
    } {c:/globTest/x1.bat c:/globTest/y1.bat c:/globTest/z1.bat}
1420
 
1421
    removeDirectory globTest
1422
 
1423
    if {($testConfig(nonPortable) != 0) && [catch {cd //gaspode/d}] == 0} {
1424
        removeDirectory globTest
1425
        makeDirectory globTest
1426
 
1427
        close [open globTest/x1.BAT w]
1428
        close [open globTest/y1.Bat w]
1429
        close [open globTest/z1.bat w]
1430
 
1431
        test filename-16.12 {windows specific globbing} {
1432
            glob //gaspode/d/*Test
1433
        } //gaspode/d/globTest
1434
        test filename-16.13 {windows specific globbing} {
1435
            glob {\\\\gaspode\\d\\*Test}
1436
        } //gaspode/d/globTest
1437
 
1438
        removeDirectory globTest
1439
    }
1440
 
1441
    cd $temp
1442
}
1443
 
1444
removeDirectory globTest
1445
set env(HOME) $oldhome
1446
 
1447
testsetplatform $platform
1448
catch {unset oldhome platform temp result}
1449
concat ""

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.