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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [insight/] [tcl/] [tests/] [registry.test] - Blame information for rev 1767

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 578 markom
# registry.test --
2
#
3
# This file contains a collection of tests for the registry command.
4
# Sourcing this file into Tcl runs the tests and generates output for
5
# errors.  No output means no errors were found.
6
#
7
# In order for these tests to run, the registry package must be on the
8
# auto_path or the registry package must have been loaded already.
9
#
10
# Copyright (c) 1997 by Sun Microsystems, Inc.  All rights reserved.
11
#
12
# RCS: @(#) $Id: registry.test,v 1.1.1.1 2002-01-16 10:25:36 markom Exp $
13
 
14
if {$tcl_platform(platform) != "windows"} {
15
    return
16
}
17
 
18
if {[string compare test [info procs test]] == 1} then {source defs}
19
 
20
set lib [lindex [glob [file join [pwd] [file dirname \
21
        [info nameofexecutable]] tclreg*.dll]] 0]
22
 
23
if [catch {load $lib registry}] {
24
    puts "Unable to find the registry package. Skipping registry tests."
25
    return
26
}
27
 
28
if {$testConfig(win32s)} {
29
    puts "Skipping registry tests under Win32s"
30
    return
31
}
32
 
33
switch $tcl_platform(os) {
34
    "Windows NT" {set testConfig(NT) 1}
35
    "Windows 95" {set testConfig(95) 1}
36
}
37
 
38
set hostname [info hostname]
39
 
40
test registry-1.1 {argument parsing for registry command} {
41
    list [catch {registry} msg] $msg
42
} {1 {wrong # args: should be "registry option ?arg arg ...?"}}
43
test registry-1.2 {argument parsing for registry command} {
44
    list [catch {registry foo} msg] $msg
45
} {1 {bad option "foo": must be delete, get, keys, set, type, or values}}
46
 
47
test registry-1.3 {argument parsing for registry command} {
48
    list [catch {registry d} msg] $msg
49
} {1 {wrong # args: should be "registry delete keyName ?valueName?"}}
50
test registry-1.4 {argument parsing for registry command} {
51
    list [catch {registry delete} msg] $msg
52
} {1 {wrong # args: should be "registry delete keyName ?valueName?"}}
53
test registry-1.5 {argument parsing for registry command} {
54
    list [catch {registry delete foo bar baz} msg] $msg
55
} {1 {wrong # args: should be "registry delete keyName ?valueName?"}}
56
 
57
test registry-1.6 {argument parsing for registry command} {
58
    list [catch {registry g} msg] $msg
59
} {1 {wrong # args: should be "registry get keyName valueName"}}
60
test registry-1.7 {argument parsing for registry command} {
61
    list [catch {registry get} msg] $msg
62
} {1 {wrong # args: should be "registry get keyName valueName"}}
63
test registry-1.8 {argument parsing for registry command} {
64
    list [catch {registry get foo} msg] $msg
65
} {1 {wrong # args: should be "registry get keyName valueName"}}
66
test registry-1.9 {argument parsing for registry command} {
67
    list [catch {registry get foo bar baz} msg] $msg
68
} {1 {wrong # args: should be "registry get keyName valueName"}}
69
 
70
test registry-1.10 {argument parsing for registry command} {
71
    list [catch {registry k} msg] $msg
72
} {1 {wrong # args: should be "registry keys keyName ?pattern?"}}
73
test registry-1.11 {argument parsing for registry command} {
74
    list [catch {registry keys} msg] $msg
75
} {1 {wrong # args: should be "registry keys keyName ?pattern?"}}
76
test registry-1.12 {argument parsing for registry command} {
77
    list [catch {registry keys foo bar baz} msg] $msg
78
} {1 {wrong # args: should be "registry keys keyName ?pattern?"}}
79
 
80
test registry-1.13 {argument parsing for registry command} {
81
    list [catch {registry s} msg] $msg
82
} {1 {wrong # args: should be "registry set keyName ?valueName data ?type??"}}
83
test registry-1.14 {argument parsing for registry command} {
84
    list [catch {registry set} msg] $msg
85
} {1 {wrong # args: should be "registry set keyName ?valueName data ?type??"}}
86
test registry-1.15 {argument parsing for registry command} {
87
    list [catch {registry set foo bar} msg] $msg
88
} {1 {wrong # args: should be "registry set keyName ?valueName data ?type??"}}
89
test registry-1.16 {argument parsing for registry command} {
90
    list [catch {registry set foo bar baz blat gorp} msg] $msg
91
} {1 {wrong # args: should be "registry set keyName ?valueName data ?type??"}}
92
 
93
test registry-1.17 {argument parsing for registry command} {
94
    list [catch {registry t} msg] $msg
95
} {1 {wrong # args: should be "registry type keyName valueName"}}
96
test registry-1.18 {argument parsing for registry command} {
97
    list [catch {registry type} msg] $msg
98
} {1 {wrong # args: should be "registry type keyName valueName"}}
99
test registry-1.19 {argument parsing for registry command} {
100
    list [catch {registry type foo} msg] $msg
101
} {1 {wrong # args: should be "registry type keyName valueName"}}
102
test registry-1.20 {argument parsing for registry command} {
103
    list [catch {registry type foo bar baz} msg] $msg
104
} {1 {wrong # args: should be "registry type keyName valueName"}}
105
 
106
test registry-1.21 {argument parsing for registry command} {
107
    list [catch {registry v} msg] $msg
108
} {1 {wrong # args: should be "registry values keyName ?pattern?"}}
109
test registry-1.22 {argument parsing for registry command} {
110
    list [catch {registry values} msg] $msg
111
} {1 {wrong # args: should be "registry values keyName ?pattern?"}}
112
test registry-1.23 {argument parsing for registry command} {
113
    list [catch {registry values foo bar baz} msg] $msg
114
} {1 {wrong # args: should be "registry values keyName ?pattern?"}}
115
 
116
test registry-2.1 {DeleteKey: bad key} {
117
    list [catch {registry delete foo} msg] $msg
118
} {1 {bad root name "foo": must be HKEY_LOCAL_MACHINE, HKEY_USERS, HKEY_CLASSES_ROOT, HKEY_CURRENT_USER, or HKEY_CURRENT_CONFIG}}
119
test registry-2.2 {DeleteKey: bad key} {
120
    list [catch {registry delete HKEY_CLASSES_ROOT} msg] $msg
121
} {1 {bad key: cannot delete root keys}}
122
test registry-2.3 {DeleteKey: bad key} {
123
    list [catch {registry delete HKEY_CLASSES_ROOT\\} msg] $msg
124
} {1 {bad key: cannot delete root keys}}
125
test registry-2.4 {DeleteKey: subkey at root level} {
126
    registry set HKEY_CLASSES_ROOT\\TclFoobar
127
    registry delete HKEY_CLASSES_ROOT\\TclFoobar
128
    registry keys HKEY_CLASSES_ROOT TclFoobar
129
} {}
130
test registry-2.5 {DeleteKey: subkey below root level} {
131
    registry set HKEY_CLASSES_ROOT\\TclFoobar\\test
132
    registry delete HKEY_CLASSES_ROOT\\TclFoobar\\test
133
    set result [registry keys HKEY_CLASSES_ROOT TclFoobar\\test]
134
    registry delete HKEY_CLASSES_ROOT\\TclFoobar
135
    set result
136
} {}
137
test registry-2.6 {DeleteKey: recursive delete} {
138
    registry set HKEY_CLASSES_ROOT\\TclFoobar\\test1
139
    registry set HKEY_CLASSES_ROOT\\TclFoobar\\test2\\test3
140
    registry delete HKEY_CLASSES_ROOT\\TclFoobar
141
    set result [registry keys HKEY_CLASSES_ROOT TclFoobar]
142
    set result
143
} {}
144
test registry-2.7 {DeleteKey: trailing backslashes} {
145
    registry set HKEY_CLASSES_ROOT\\TclFoobar\\baz
146
    list [catch {registry delete HKEY_CLASSES_ROOT\\TclFoobar\\} msg] $msg
147
} {1 {unable to delete key: The configuration registry key is invalid.}}
148
test registry-2.8 {DeleteKey: failure} {
149
    registry delete HKEY_CLASSES_ROOT\\TclFoobar
150
    registry delete HKEY_CLASSES_ROOT\\TclFoobar
151
} {}
152
 
153
 
154
test registry-3.1 {DeleteValue} {
155
    registry delete HKEY_CLASSES_ROOT\\TclFoobar
156
    registry set HKEY_CLASSES_ROOT\\TclFoobar\\baz test1 blort
157
    registry set HKEY_CLASSES_ROOT\\TclFoobar\\baz test2 blat
158
    registry delete HKEY_CLASSES_ROOT\\TclFoobar\\baz test1
159
    set result [registry values HKEY_CLASSES_ROOT\\TclFoobar\\baz]
160
    registry delete HKEY_CLASSES_ROOT\\TclFoobar
161
    set result
162
} test2
163
test registry-3.2 {DeleteValue: bad key} {
164
    registry delete HKEY_CLASSES_ROOT\\TclFoobar
165
    list [catch {registry delete HKEY_CLASSES_ROOT\\TclFoobar test} msg] $msg
166
} {1 {unable to open key: The system cannot find the file specified.}}
167
test registry-3.3 {DeleteValue: bad value} {
168
    registry delete HKEY_CLASSES_ROOT\\TclFoobar
169
    registry set HKEY_CLASSES_ROOT\\TclFoobar\\baz test2 blort
170
    set result [list [catch {registry delete HKEY_CLASSES_ROOT\\TclFoobar test1} msg] $msg]
171
    registry delete HKEY_CLASSES_ROOT\\TclFoobar
172
    set result
173
} {1 {unable to delete value "test1" from key "HKEY_CLASSES_ROOT\TclFoobar": The system cannot find the file specified.}}
174
 
175
 
176
test registry-4.1 {GetKeyNames: bad key} {
177
    registry delete HKEY_CLASSES_ROOT\\TclFoobar
178
    list [catch {registry keys HKEY_CLASSES_ROOT\\TclFoobar} msg] $msg
179
} {1 {unable to open key: The system cannot find the file specified.}}
180
test registry-4.2 {GetKeyNames} {
181
    registry delete HKEY_CLASSES_ROOT\\TclFoobar
182
    registry set HKEY_CLASSES_ROOT\\TclFoobar\\baz
183
    set result [registry keys HKEY_CLASSES_ROOT\\TclFoobar]
184
    registry delete HKEY_CLASSES_ROOT\\TclFoobar
185
    set result
186
} {baz}
187
test registry-4.3 {GetKeyNames: remote key} {nonPortable} {
188
    registry set \\\\$hostname\\HKEY_CLASSES_ROOT\\TclFoobar\\baz
189
    set result [registry keys \\\\gaspode\\HKEY_CLASSES_ROOT\\TclFoobar]
190
    registry delete \\\\$hostname\\HKEY_CLASSES_ROOT\\TclFoobar
191
    set result
192
} {baz}
193
test registry-4.4 {GetKeyNames: empty key} {
194
    registry delete HKEY_CLASSES_ROOT\\TclFoobar
195
    registry set HKEY_CLASSES_ROOT\\TclFoobar
196
    set result [registry keys HKEY_CLASSES_ROOT\\TclFoobar]
197
    registry delete HKEY_CLASSES_ROOT\\TclFoobar
198
    set result
199
} {}
200
test registry-4.5 {GetKeyNames: patterns} {
201
    registry delete HKEY_CLASSES_ROOT\\TclFoobar
202
    registry set HKEY_CLASSES_ROOT\\TclFoobar\\baz
203
    registry set HKEY_CLASSES_ROOT\\TclFoobar\\blat
204
    registry set HKEY_CLASSES_ROOT\\TclFoobar\\foo
205
    set result [lsort [registry keys HKEY_CLASSES_ROOT\\TclFoobar b*]]
206
    registry delete HKEY_CLASSES_ROOT\\TclFoobar
207
    set result
208
} {baz blat}
209
test registry-4.6 {GetKeyNames: names with spaces} {
210
    registry delete HKEY_CLASSES_ROOT\\TclFoobar
211
    registry set HKEY_CLASSES_ROOT\\TclFoobar\\baz\ bar
212
    registry set HKEY_CLASSES_ROOT\\TclFoobar\\blat
213
    registry set HKEY_CLASSES_ROOT\\TclFoobar\\foo
214
    set result [lsort [registry keys HKEY_CLASSES_ROOT\\TclFoobar b*]]
215
    registry delete HKEY_CLASSES_ROOT\\TclFoobar
216
    set result
217
} {{baz bar} blat}
218
 
219
test registry-5.1 {GetType} {
220
    registry delete HKEY_CLASSES_ROOT\\TclFoobar
221
    list [catch {registry type HKEY_CLASSES_ROOT\\TclFoobar val1} msg] $msg
222
} {1 {unable to open key: The system cannot find the file specified.}}
223
test registry-5.2 {GetType} {
224
    registry set HKEY_CLASSES_ROOT\\TclFoobar
225
    list [catch {registry type HKEY_CLASSES_ROOT\\TclFoobar val1} msg] $msg
226
} {1 {unable to get type of value "val1" from key "HKEY_CLASSES_ROOT\TclFoobar": The system cannot find the file specified.}}
227
test registry-5.3 {GetType} {
228
    registry set HKEY_CLASSES_ROOT\\TclFoobar val1 foobar none
229
    set result [registry type HKEY_CLASSES_ROOT\\TclFoobar val1]
230
    registry delete HKEY_CLASSES_ROOT\\TclFoobar
231
    set result
232
} none
233
test registry-5.4 {GetType} {
234
    registry set HKEY_CLASSES_ROOT\\TclFoobar val1 foobar
235
    set result [registry type HKEY_CLASSES_ROOT\\TclFoobar val1]
236
    registry delete HKEY_CLASSES_ROOT\\TclFoobar
237
    set result
238
} sz
239
test registry-5.5 {GetType} {
240
    registry set HKEY_CLASSES_ROOT\\TclFoobar val1 foobar sz
241
    set result [registry type HKEY_CLASSES_ROOT\\TclFoobar val1]
242
    registry delete HKEY_CLASSES_ROOT\\TclFoobar
243
    set result
244
} sz
245
test registry-5.6 {GetType} {
246
    registry set HKEY_CLASSES_ROOT\\TclFoobar val1 foobar expand_sz
247
    set result [registry type HKEY_CLASSES_ROOT\\TclFoobar val1]
248
    registry delete HKEY_CLASSES_ROOT\\TclFoobar
249
    set result
250
} expand_sz
251
test registry-5.7 {GetType} {
252
    registry set HKEY_CLASSES_ROOT\\TclFoobar val1 1 binary
253
    set result [registry type HKEY_CLASSES_ROOT\\TclFoobar val1]
254
    registry delete HKEY_CLASSES_ROOT\\TclFoobar
255
    set result
256
} binary
257
test registry-5.8 {GetType} {
258
    registry set HKEY_CLASSES_ROOT\\TclFoobar val1 1 dword
259
    set result [registry type HKEY_CLASSES_ROOT\\TclFoobar val1]
260
    registry delete HKEY_CLASSES_ROOT\\TclFoobar
261
    set result
262
} dword
263
test registry-5.9 {GetType} {
264
    registry set HKEY_CLASSES_ROOT\\TclFoobar val1 1 dword_big_endian
265
    set result [registry type HKEY_CLASSES_ROOT\\TclFoobar val1]
266
    registry delete HKEY_CLASSES_ROOT\\TclFoobar
267
    set result
268
} dword_big_endian
269
test registry-5.10 {GetType} {
270
    registry set HKEY_CLASSES_ROOT\\TclFoobar val1 1 link
271
    set result [registry type HKEY_CLASSES_ROOT\\TclFoobar val1]
272
    registry delete HKEY_CLASSES_ROOT\\TclFoobar
273
    set result
274
} link
275
test registry-5.11 {GetType} {
276
    registry set HKEY_CLASSES_ROOT\\TclFoobar val1 foobar multi_sz
277
    set result [registry type HKEY_CLASSES_ROOT\\TclFoobar val1]
278
    registry delete HKEY_CLASSES_ROOT\\TclFoobar
279
    set result
280
} multi_sz
281
test registry-5.12 {GetType} {
282
    registry set HKEY_CLASSES_ROOT\\TclFoobar val1 1 resource_list
283
    set result [registry type HKEY_CLASSES_ROOT\\TclFoobar val1]
284
    registry delete HKEY_CLASSES_ROOT\\TclFoobar
285
    set result
286
} resource_list
287
test registry-5.13 {GetType: unknown types} {
288
    registry set HKEY_CLASSES_ROOT\\TclFoobar val1 1 24
289
    set result [registry type HKEY_CLASSES_ROOT\\TclFoobar val1]
290
    registry delete HKEY_CLASSES_ROOT\\TclFoobar
291
    set result
292
} 24
293
 
294
test registry-6.1 {GetValue} {
295
    registry delete HKEY_CLASSES_ROOT\\TclFoobar
296
    list [catch {registry get HKEY_CLASSES_ROOT\\TclFoobar val1} msg] $msg
297
} {1 {unable to open key: The system cannot find the file specified.}}
298
test registry-6.2 {GetValue} {
299
    registry set HKEY_CLASSES_ROOT\\TclFoobar
300
    list [catch {registry get HKEY_CLASSES_ROOT\\TclFoobar val1} msg] $msg
301
} {1 {unable to get value "val1" from key "HKEY_CLASSES_ROOT\TclFoobar": The system cannot find the file specified.}}
302
test registry-6.3 {GetValue} {
303
    registry set HKEY_CLASSES_ROOT\\TclFoobar val1 foobar none
304
    set result [registry get HKEY_CLASSES_ROOT\\TclFoobar val1]
305
    registry delete HKEY_CLASSES_ROOT\\TclFoobar
306
    set result
307
} foobar
308
test registry-6.4 {GetValue} {
309
    registry set HKEY_CLASSES_ROOT\\TclFoobar val1 foobar
310
    set result [registry get HKEY_CLASSES_ROOT\\TclFoobar val1]
311
    registry delete HKEY_CLASSES_ROOT\\TclFoobar
312
    set result
313
} foobar
314
test registry-6.5 {GetValue} {
315
    registry set HKEY_CLASSES_ROOT\\TclFoobar val1 foobar sz
316
    set result [registry get HKEY_CLASSES_ROOT\\TclFoobar val1]
317
    registry delete HKEY_CLASSES_ROOT\\TclFoobar
318
    set result
319
} foobar
320
test registry-6.6 {GetValue} {
321
    registry set HKEY_CLASSES_ROOT\\TclFoobar val1 foobar expand_sz
322
    set result [registry get HKEY_CLASSES_ROOT\\TclFoobar val1]
323
    registry delete HKEY_CLASSES_ROOT\\TclFoobar
324
    set result
325
} foobar
326
test registry-6.7 {GetValue} {
327
    registry set HKEY_CLASSES_ROOT\\TclFoobar val1 1 binary
328
    set result [registry get HKEY_CLASSES_ROOT\\TclFoobar val1]
329
    registry delete HKEY_CLASSES_ROOT\\TclFoobar
330
    set result
331
} 1
332
test registry-6.8 {GetValue} {
333
    registry set HKEY_CLASSES_ROOT\\TclFoobar val1 0x20 dword
334
    set result [registry get HKEY_CLASSES_ROOT\\TclFoobar val1]
335
    registry delete HKEY_CLASSES_ROOT\\TclFoobar
336
    set result
337
} 32
338
test registry-6.9 {GetValue} {
339
    registry set HKEY_CLASSES_ROOT\\TclFoobar val1 0x20 dword_big_endian
340
    set result [registry get HKEY_CLASSES_ROOT\\TclFoobar val1]
341
    registry delete HKEY_CLASSES_ROOT\\TclFoobar
342
    set result
343
} 32
344
test registry-6.10 {GetValue} {
345
    registry set HKEY_CLASSES_ROOT\\TclFoobar val1 1 link
346
    set result [registry get HKEY_CLASSES_ROOT\\TclFoobar val1]
347
    registry delete HKEY_CLASSES_ROOT\\TclFoobar
348
    set result
349
} 1
350
test registry-6.11 {GetValue} {
351
    registry set HKEY_CLASSES_ROOT\\TclFoobar val1 foobar multi_sz
352
    set result [registry get HKEY_CLASSES_ROOT\\TclFoobar val1]
353
    registry delete HKEY_CLASSES_ROOT\\TclFoobar
354
    set result
355
} foobar
356
test registry-6.12 {GetValue} {
357
    registry set HKEY_CLASSES_ROOT\\TclFoobar val1 {foo\ bar baz} multi_sz
358
    set result [registry get HKEY_CLASSES_ROOT\\TclFoobar val1]
359
    registry delete HKEY_CLASSES_ROOT\\TclFoobar
360
    set result
361
} {{foo bar} baz}
362
test registry-6.13 {GetValue} {
363
    registry set HKEY_CLASSES_ROOT\\TclFoobar val1 {} multi_sz
364
    set result [registry get HKEY_CLASSES_ROOT\\TclFoobar val1]
365
    registry delete HKEY_CLASSES_ROOT\\TclFoobar
366
    set result
367
} {}
368
test registry-6.14 {GetValue: truncation of multivalues with null elements} {
369
    registry set HKEY_CLASSES_ROOT\\TclFoobar val1 {a {} b} multi_sz
370
    set result [registry get HKEY_CLASSES_ROOT\\TclFoobar val1]
371
    registry delete HKEY_CLASSES_ROOT\\TclFoobar
372
    set result
373
} a
374
test registry-6.15 {GetValue} {
375
    registry set HKEY_CLASSES_ROOT\\TclFoobar val1 1 resource_list
376
    set result [registry get HKEY_CLASSES_ROOT\\TclFoobar val1]
377
    registry delete HKEY_CLASSES_ROOT\\TclFoobar
378
    set result
379
} 1
380
test registry-6.16 {GetValue: unknown types} {
381
    registry set HKEY_CLASSES_ROOT\\TclFoobar val1 1 24
382
    set result [registry get HKEY_CLASSES_ROOT\\TclFoobar val1]
383
    registry delete HKEY_CLASSES_ROOT\\TclFoobar
384
    set result
385
} 1
386
 
387
test registry-7.1 {GetValueNames: bad key} {
388
    registry delete HKEY_CLASSES_ROOT\\TclFoobar
389
    list [catch {registry values HKEY_CLASSES_ROOT\\TclFoobar} msg] $msg
390
} {1 {unable to open key: The system cannot find the file specified.}}
391
test registry-7.2 {GetValueNames} {
392
    registry delete HKEY_CLASSES_ROOT\\TclFoobar
393
    registry set HKEY_CLASSES_ROOT\\TclFoobar baz foobar
394
    set result [registry values HKEY_CLASSES_ROOT\\TclFoobar]
395
    registry delete HKEY_CLASSES_ROOT\\TclFoobar
396
    set result
397
} baz
398
test registry-7.3 {GetValueNames} {
399
    registry delete HKEY_CLASSES_ROOT\\TclFoobar
400
    registry set HKEY_CLASSES_ROOT\\TclFoobar baz foobar1
401
    registry set HKEY_CLASSES_ROOT\\TclFoobar blat foobar2
402
    registry set HKEY_CLASSES_ROOT\\TclFoobar {} foobar3
403
    set result [lsort [registry values HKEY_CLASSES_ROOT\\TclFoobar]]
404
    registry delete HKEY_CLASSES_ROOT\\TclFoobar
405
    set result
406
} {{} baz blat}
407
test registry-7.4 {GetValueNames: remote key} {nonPortable} {
408
    registry set \\\\$hostname\\HKEY_CLASSES_ROOT\\TclFoobar baz blat
409
    set result [registry values \\\\gaspode\\HKEY_CLASSES_ROOT\\TclFoobar]
410
    registry delete \\\\$hostname\\HKEY_CLASSES_ROOT\\TclFoobar
411
    set result
412
} baz
413
test registry-7.5 {GetValueNames: empty key} {
414
    registry delete HKEY_CLASSES_ROOT\\TclFoobar
415
    registry set HKEY_CLASSES_ROOT\\TclFoobar
416
    set result [registry values HKEY_CLASSES_ROOT\\TclFoobar]
417
    registry delete HKEY_CLASSES_ROOT\\TclFoobar
418
    set result
419
} {}
420
test registry-7.6 {GetValueNames: patterns} {
421
    registry delete HKEY_CLASSES_ROOT\\TclFoobar
422
    registry set HKEY_CLASSES_ROOT\\TclFoobar baz foobar1
423
    registry set HKEY_CLASSES_ROOT\\TclFoobar blat foobar2
424
    registry set HKEY_CLASSES_ROOT\\TclFoobar foo foobar3
425
    set result [lsort [registry values HKEY_CLASSES_ROOT\\TclFoobar b*]]
426
    registry delete HKEY_CLASSES_ROOT\\TclFoobar
427
    set result
428
} {baz blat}
429
test registry-7.7 {GetValueNames: names with spaces} {
430
    registry delete HKEY_CLASSES_ROOT\\TclFoobar
431
    registry set HKEY_CLASSES_ROOT\\TclFoobar baz\ bar foobar1
432
    registry set HKEY_CLASSES_ROOT\\TclFoobar blat foobar2
433
    registry set HKEY_CLASSES_ROOT\\TclFoobar foo foobar3
434
    set result [lsort [registry values HKEY_CLASSES_ROOT\\TclFoobar b*]]
435
    registry delete HKEY_CLASSES_ROOT\\TclFoobar
436
    set result
437
} {{baz bar} blat}
438
 
439
test registry-8.1 {OpenSubKey} {nonPortable} {
440
    list [catch {registry keys {\\petrouchka\HKEY_LOCAL_MACHINE}} msg] $msg
441
} {1 {unable to open key: Access is denied.}}
442
test registry-8.2 {OpenSubKey} {
443
    registry delete HKEY_CLASSES_ROOT\\TclFoobar
444
    registry set HKEY_CLASSES_ROOT\\TclFoobar
445
    set result [registry keys HKEY_CLASSES_ROOT TclFoobar]
446
    registry delete HKEY_CLASSES_ROOT\\TclFoobar
447
    set result
448
} TclFoobar
449
test registry-8.3 {OpenSubKey} {
450
    registry delete HKEY_CLASSES_ROOT\\TclFoobar
451
    list [catch {registry keys HKEY_CLASSES_ROOT\\TclFoobar} msg] $msg
452
} {1 {unable to open key: The system cannot find the file specified.}}
453
 
454
test registry-9.1 {ParseKeyName: bad keys} {
455
    list [catch {registry values \\} msg] $msg
456
} "1 {bad key \"\\\": must start with a valid root}"
457
test registry-9.2 {ParseKeyName: bad keys} {
458
    list [catch {registry values \\foobar} msg] $msg
459
} {1 {bad key "\foobar": must start with a valid root}}
460
test registry-9.3 {ParseKeyName: bad keys} {
461
    list [catch {registry values \\\\} msg] $msg
462
} {1 {ambiguous root name "": must be HKEY_LOCAL_MACHINE, HKEY_USERS, HKEY_CLASSES_ROOT, HKEY_CURRENT_USER, or HKEY_CURRENT_CONFIG}}
463
test registry-9.4 {ParseKeyName: bad keys} {
464
    list [catch {registry values \\\\\\} msg] $msg
465
} {1 {ambiguous root name "": must be HKEY_LOCAL_MACHINE, HKEY_USERS, HKEY_CLASSES_ROOT, HKEY_CURRENT_USER, or HKEY_CURRENT_CONFIG}}
466
test registry-9.5 {ParseKeyName: bad keys} {
467
    list [catch {registry values \\\\\\HKEY_CLASSES_ROOT} msg] $msg
468
} {1 {unable to open key: The network address is invalid.}}
469
test registry-9.6 {ParseKeyName: bad keys} {
470
    list [catch {registry values \\\\gaspode} msg] $msg
471
} {1 {ambiguous root name "": must be HKEY_LOCAL_MACHINE, HKEY_USERS, HKEY_CLASSES_ROOT, HKEY_CURRENT_USER, or HKEY_CURRENT_CONFIG}}
472
test registry-9.7 {ParseKeyName: bad keys} {
473
    list [catch {registry values foobar} msg] $msg
474
} {1 {bad root name "foobar": must be HKEY_LOCAL_MACHINE, HKEY_USERS, HKEY_CLASSES_ROOT, HKEY_CURRENT_USER, or HKEY_CURRENT_CONFIG}}
475
test registry-9.8 {ParseKeyName: null keys} {
476
    list [catch {registry delete HKEY_CLASSES_ROOT\\} msg] $msg
477
} {1 {bad key: cannot delete root keys}}
478
test registry-9.9 {ParseKeyName: null keys} {
479
    list [catch {registry keys HKEY_CLASSES_ROOT\\TclFoobar\\baz} msg] $msg
480
} {1 {unable to open key: The system cannot find the file specified.}}
481
 
482
test registry-10.1 {RecursiveDeleteKey} {
483
    registry delete HKEY_CLASSES_ROOT\\TclFoobar
484
    registry set HKEY_CLASSES_ROOT\\TclFoobar\\test1
485
    registry set HKEY_CLASSES_ROOT\\TclFoobar\\test2\\test3
486
    registry delete HKEY_CLASSES_ROOT\\TclFoobar
487
    set result [registry keys HKEY_CLASSES_ROOT TclFoobar]
488
    set result
489
} {}
490
test registry-10.2 {RecursiveDeleteKey} {
491
    registry delete HKEY_CLASSES_ROOT\\TclFoobar
492
    registry set HKEY_CLASSES_ROOT\\TclFoobar\\test1
493
    registry set HKEY_CLASSES_ROOT\\TclFoobar\\test2\\test3
494
    set result [registry delete HKEY_CLASSES_ROOT\\TclFoobar\\test2\\test4]
495
    registry delete HKEY_CLASSES_ROOT\\TclFoobar
496
    set result
497
} {}
498
 
499
test registry-11.1 {SetValue: recursive creation} {
500
    registry delete HKEY_CLASSES_ROOT\\TclFoobar
501
    registry set HKEY_CLASSES_ROOT\\TclFoobar\\baz blat foobar
502
    set result [registry get HKEY_CLASSES_ROOT\\TclFoobar\\baz blat]
503
} foobar
504
test registry-11.2 {SetValue: modification} {
505
    registry delete HKEY_CLASSES_ROOT\\TclFoobar
506
    registry set HKEY_CLASSES_ROOT\\TclFoobar\\baz blat foobar
507
    registry set HKEY_CLASSES_ROOT\\TclFoobar\\baz blat frob
508
    set result [registry get HKEY_CLASSES_ROOT\\TclFoobar\\baz blat]
509
} frob
510
test registry-11.3 {SetValue: failure} {nonPortable} {
511
    list [catch {registry set {\\petrouchka\HKEY_CLASSES_ROOT\TclFoobar} bar foobar} msg] $msg
512
} {1 {unable to open key: Access is denied.}}
513
 
514
 
515
unset hostname

powered by: WebSVN 2.1.0

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