Tcl Library Source Code

Check-in [022a85f807]
Login
Bounty program for improvements to Tcl and certain Tcl packages.
Tcl 2019 Conference, Houston/TX, US, Nov 4-8
Send your abstracts to [email protected]
or submit via the online form by Sep 9.

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:namespacex - Forward porting commit [ccd9433cb2abd51c] Part 1: Tests. Extended the testsuite to demonstrate that the current command implementations mishandle relative namespace arguments if they are not refering to a child of the global namespace :: Note, the changes made here diverge totally from the changes made in the original commit. Explicitly added new tests to cover the mishandled cases, leaving the existing coverage intact. The original commit OTOH shifted the entire testsuite over to cover relative namespace names, retracting the coverage for fully-qualified namespace names.
Timelines: family | ancestors | descendants | both | gam-namespacex-improve
Files: files | file ages | folders
SHA3-256: 022a85f807444c6604a022d833046cb8504bb83f5a1d13fb452bd0f421c6d17e
User & Date: aku 2019-03-01 07:09:45
Context
2019-03-01
07:14
namespacex - Forward porting commit [ccd9433cb2abd51c] Part 2: Bug fix. Fixed the mishandling of relative namespace arguments if they are not refering to a child of the global namespace :: The bug fix is accepted as is from the original commit, with thanks to Pooryorick (Nathan Coulter). check-in: b9ccb9de72 user: aku tags: gam-namespacex-improve
07:09
namespacex - Forward porting commit [ccd9433cb2abd51c] Part 1: Tests. Extended the testsuite to demonstrate that the current command implementations mishandle relative namespace arguments if they are not refering to a child of the global namespace :: Note, the changes made here diverge totally from the changes made in the original commit. Explicitly added new tests to cover the mishandled cases, leaving the existing coverage intact. The original commit OTOH shifted the entire testsuite over to cover relative namespace names, retracting the coverage for fully-qualified namespace names. check-in: 022a85f807 user: aku tags: gam-namespacex-improve
2019-02-21
07:19
Forward port of Andrew Mangogna's fixup work for the namespacex package. Partial port of Pooryorick's extensions, just enough to work and pass a mostly unmodified testsuite. Still to investigate and port the larger changes for relative namespace references, in both code and tests. check-in: 2dfb59ac95 user: aku tags: gam-namespacex-improve
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to modules/namespacex/namespacex.test.

12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
...
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148










149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166


















167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182


















183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209










210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225










226
227
228
229
230
231
232
233
234
235
236
237
238
239
240










241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267










268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283










284
285
286
287
288
289
290
291
292
293
294
295
296
297
298










299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327











328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345











346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362











363
364
365
366
367
368
369
...
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399














400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420














421
422
423
424
425
426
427
428
testing {
    useLocal namespacex.tcl namespacex
}

# -------------------------------------------------------------------------

proc ns_setup {} {
    namespace eval ::X {
        namespace eval A {}
        namespace eval B {
            namespace eval D {}
        }
        namespace eval C {}
    }
}

proc ns2_setup {} {
    namespace eval ::X {
        variable vXa 1
        variable vXb aleph
        namespace eval B {
            variable vB 3
        }
    }
}

proc ns3_setup {} {
    namespace eval ::X {
        namespace eval B {
            variable vB mjolnir
        }
    }
}

# -------------------------------------------------------------------------
................................................................................
    namespacex info allchildren
} -returnCodes error -result {wrong # args: should be "namespacex info allchildren ns"}

test namespacex-info-allchildren-1.1 {namespacex info allchildren, wrong\#args} -body {
    namespacex info allchildren N X
} -returnCodes error -result {wrong # args: should be "namespacex info allchildren ns"}

test namespacex-info-allchildren-2.0.0 {namespacex info allchildren} -setup {
    ns_setup
} -body {
    lsort -dict [namespacex info allchildren ::X]
} -cleanup {
    namespace delete ::X
} -result {::X::A ::X::B ::X::B::D ::X::C}

test namespacex-info-allchildren-2.0.1 {namespacex info allchildren} -setup {
    ns_setup
} -body {
    lsort -dict [namespacex info allchildren X]
} -cleanup {
    namespace delete ::X
} -result {::X::A ::X::B ::X::B::D ::X::C}











# -------------------------------------------------------------------------

test namespacex-info-vars-1.0 {namespacex info vars, wrong\#args} -body {
    namespacex info vars
} -returnCodes error -result {wrong # args: should be "namespacex info vars ns ?pattern?"}

test namespacex-info-vars-1.1 {namespacex info vars, wrong\#args} -body {
    namespacex info vars N P X
} -returnCodes error -result {wrong # args: should be "namespacex info vars ns ?pattern?"}

test namespacex-info-vars-2.0 {namespacex info vars} -setup {
    ns2_setup
} -body {
    lsort -dict [namespacex info vars ::X]
} -cleanup {
    namespace delete ::X
} -result {vXa vXb}



















test namespacex-info-vars-2.1 {namespacex info vars} -setup {
    namespace eval ::X {}
} -body {
    lsort -dict [namespacex info vars ::X]
} -cleanup {
    namespace delete ::X
} -result {}

test namespacex-info-vars-2.2 {namespacex info vars} -setup {
    ns3_setup
} -body {
    lsort -dict [namespacex info vars ::X]
} -cleanup {
    namespace delete ::X
} -result {}



















# -------------------------------------------------------------------------

test namespacex-info-allvars-1.0 {namespacex info allvars, wrong\#args} -body {
    namespacex info allvars
} -returnCodes error -result {wrong # args: should be "namespacex info allvars ns"}

test namespacex-info-allvars-1.1 {namespacex info allvars, wrong\#args} -body {
    namespacex info allvars N X
} -returnCodes error -result {wrong # args: should be "namespacex info allvars ns"}

test namespacex-info-allvars-2.0.0 {namespacex info allvars} -setup {
    ns2_setup
} -body {
    lsort -dict [namespacex info allvars ::X]
} -cleanup {
    namespace delete ::X
} -result {B::vB vXa vXb}

test namespacex-info-allvars-2.0.1 {namespacex info allvars} -setup {
    ns2_setup
} -body {
    lsort -dict [namespacex info allvars X]
} -cleanup {
    namespace delete ::X
} -result {B::vB vXa vXb}











test namespacex-info-allvars-2.1.0 {namespacex info allvars} -setup {
    namespace eval ::X {}
} -body {
    lsort -dict [namespacex info allvars ::X]
} -cleanup {
    namespace delete ::X
} -result {}

test namespacex-info-allvars-2.1.1 {namespacex info allvars} -setup {
    namespace eval ::X {}
} -body {
    lsort -dict [namespacex info allvars X]
} -cleanup {
    namespace delete ::X
} -result {}











test namespacex-info-allvars-2.2.0 {namespacex info allvars} -setup {
    ns3_setup
} -body {
    lsort -dict [namespacex info allvars ::X]
} -cleanup {
    namespace delete ::X
} -result {B::vB}

test namespacex-info-allvars-2.2.1 {namespacex info allvars} -setup {
    ns3_setup
} -body {
    lsort -dict [namespacex info allvars X]
} -cleanup {
    namespace delete ::X
} -result {B::vB}











# -------------------------------------------------------------------------

test namespacex-state-get-1.0 {namespacex state get, wrong\#args} -body {
    namespacex state get
} -returnCodes error -result {wrong # args: should be "namespacex state get ns"}

test namespacex-state-get-1.1 {namespacex state get, wrong\#args} -body {
    namespacex state get N X
} -returnCodes error -result {wrong # args: should be "namespacex state get ns"}

test namespacex-state-get-2.0.0 {namespacex state get} -setup {
    ns2_setup
} -body {
    dictsort [namespacex state get ::X]
} -cleanup {
    namespace delete ::X
} -result {B::vB 3 vXa 1 vXb aleph}

test namespacex-state-get-2.0.1 {namespacex state get} -setup {
    ns2_setup
} -body {
    dictsort [namespacex state get X]
} -cleanup {
    namespace delete ::X
} -result {B::vB 3 vXa 1 vXb aleph}











test namespacex-state-get-2.1.0 {namespacex state get} -setup {
    namespace eval ::X {}
} -body {
    dictsort [namespacex state get ::X]
} -cleanup {
    namespace delete ::X
} -result {}

test namespacex-state-get-2.1.1 {namespacex state get} -setup {
    namespace eval ::X {}
} -body {
    dictsort [namespacex state get X]
} -cleanup {
    namespace delete ::X
} -result {}











test namespacex-state-get-2.2.0 {namespacex state get} -setup {
    ns3_setup
} -body {
    dictsort [namespacex state get ::X]
} -cleanup {
    namespace delete ::X
} -result {B::vB mjolnir}

test namespacex-state-get-2.2.1 {namespacex state get} -setup {
    ns3_setup
} -body {
    dictsort [namespacex state get X]
} -cleanup {
    namespace delete ::X
} -result {B::vB mjolnir}











# -------------------------------------------------------------------------

test namespacex-state-drop-1.0 {namespacex state drop, wrong\#args} -body {
    namespacex state drop
} -returnCodes error -result {wrong # args: should be "namespacex state drop ns"}

test namespacex-state-drop-1.1 {namespacex state drop, wrong\#args} -body {
    namespacex state drop N X
} -returnCodes error -result {wrong # args: should be "namespacex state drop ns"}

test namespacex-state-drop-2.0.0 {namespacex state drop} -setup {
    ns2_setup
} -body {
    namespacex state drop ::X
    dictsort [namespacex state get ::X]
} -cleanup {
    namespace delete ::X
} -result {}

test namespacex-state-drop-2.0.1 {namespacex state drop} -setup {
    ns2_setup
} -body {
    namespacex state drop X
    dictsort [namespacex state get X]
} -cleanup {
    namespace delete ::X
} -result {}












test namespacex-state-drop-2.1.0 {namespacex state drop} -setup {
    namespace eval ::X {}
} -body {
    namespacex state drop X
    dictsort [namespacex state get ::X]
} -cleanup {
    namespace delete ::X
} -result {}

test namespacex-state-drop-2.1.1 {namespacex state drop} -setup {
    namespace eval ::X {}
} -body {
    namespacex state drop X
    dictsort [namespacex state get X]
} -cleanup {
    namespace delete ::X
} -result {}












test namespacex-state-drop-2.2.0 {namespacex state drop} -setup {
    ns3_setup
} -body {
    namespacex state drop X
    dictsort [namespacex state get ::X]
} -cleanup {
    namespace delete ::X
} -result {}

test namespacex-state-drop-2.2.1 {namespacex state drop} -setup {
    ns3_setup
} -body {
    namespacex state drop X
    dictsort [namespacex state get X]
} -cleanup {
    namespace delete ::X
} -result {}












# -------------------------------------------------------------------------

test namespacex-state-set-1.0 {namespacex state set, wrong\#args} -body {
    namespacex state set
} -returnCodes error -result {wrong # args: should be "namespacex state set ns state"}

................................................................................
    namespacex state set N
} -returnCodes error -result {wrong # args: should be "namespacex state set ns state"}

test namespacex-state-set-1.2 {namespacex state set, wrong\#args} -body {
    namespacex state set N S X
} -returnCodes error -result {wrong # args: should be "namespacex state set ns state"}

test namespacex-state-set-2.0.0 {namespacex state set} -setup {
    ns2_setup
    set ST [namespacex state get ::X]
    ns3_setup
} -body {
    namespacex state set ::X $ST
    dictsort [namespacex state get ::X]
} -cleanup {
    namespace delete ::X
} -result {B::vB 3 vXa 1 vXb aleph}

test namespacex-state-set-2.0.1 {namespacex state set} -setup {
    ns2_setup
    set ST [namespacex state get ::X]
    ns3_setup
} -body {
    namespacex state set X $ST
    dictsort [namespacex state get X]
} -cleanup {
    namespace delete ::X
} -result {B::vB 3 vXa 1 vXb aleph}















test namespacex-state-set-2.1.0 {namespacex state set} -setup {
    ns3_setup
    set ST [namespacex state get ::X]
    ns2_setup
} -body {
    namespacex state set ::X $ST
    dictsort [namespacex state get ::X]
} -cleanup {
    namespace delete ::X
} -result {B::vB mjolnir}

test namespacex-state-set-2.1.1 {namespacex state set} -setup {
    ns3_setup
    set ST [namespacex state get ::X]
    ns2_setup
} -body {
    namespacex state set X $ST
    dictsort [namespacex state get X]
} -cleanup {
    namespace delete ::X
} -result {B::vB mjolnir}















# -------------------------------------------------------------------------
testsuiteCleanup

# Local variables:
# mode: tcl
# indent-tabs-mode: nil
# End:






|
|








|
|








|
|







 







|







|






>
>
>
>
>
>
>
>
>
>











|






>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>









|






>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>











|







|







>
>
>
>
>
>
>
>
>
>
|







|







>
>
>
>
>
>
>
>
>
>
|







|






>
>
>
>
>
>
>
>
>
>











|







|







>
>
>
>
>
>
>
>
>
>
|







|







>
>
>
>
>
>
>
>
>
>
|







|






>
>
>
>
>
>
>
>
>
>











|








|








>
>
>
>
>
>
>
>
>
>
>
|








|








>
>
>
>
>
>
>
>
>
>
>
|








|







>
>
>
>
>
>
>
>
>
>
>







 







|










|










>
>
>
>
>
>
>
>
>
>
>
>
>
>
|










|









>
>
>
>
>
>
>
>
>
>
>
>
>
>








12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
...
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
...
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
testing {
    useLocal namespacex.tcl namespacex
}

# -------------------------------------------------------------------------

proc ns_setup {{parent {}}} {
    namespace eval ${parent}::X {
        namespace eval A {}
        namespace eval B {
            namespace eval D {}
        }
        namespace eval C {}
    }
}

proc ns2_setup {{parent {}}} {
    namespace eval ${parent}::X {
        variable vXa 1
        variable vXb aleph
        namespace eval B {
            variable vB 3
        }
    }
}

proc ns3_setup {{parent {}}} {
    namespace eval ${parent}::X {
        namespace eval B {
            variable vB mjolnir
        }
    }
}

# -------------------------------------------------------------------------
................................................................................
    namespacex info allchildren
} -returnCodes error -result {wrong # args: should be "namespacex info allchildren ns"}

test namespacex-info-allchildren-1.1 {namespacex info allchildren, wrong\#args} -body {
    namespacex info allchildren N X
} -returnCodes error -result {wrong # args: should be "namespacex info allchildren ns"}

test namespacex-info-allchildren-2.0.0 {namespacex info allchildren, fqn} -setup {
    ns_setup
} -body {
    lsort -dict [namespacex info allchildren ::X]
} -cleanup {
    namespace delete ::X
} -result {::X::A ::X::B ::X::B::D ::X::C}

test namespacex-info-allchildren-2.0.1 {namespacex info allchildren, relative to global} -setup {
    ns_setup
} -body {
    lsort -dict [namespacex info allchildren X]
} -cleanup {
    namespace delete ::X
} -result {::X::A ::X::B ::X::B::D ::X::C}

test namespacex-info-allchildren-2.0.2 {namespacex info allchildren, relative to non-global} -setup {
    ns_setup ::Q
} -body {
    namespace eval ::Q {
        lsort -dict [namespacex info allchildren X]
    }
} -cleanup {
    namespace delete ::Q
} -result {::Q::X::A ::Q::X::B ::Q::X::B::D ::Q::X::C}

# -------------------------------------------------------------------------

test namespacex-info-vars-1.0 {namespacex info vars, wrong\#args} -body {
    namespacex info vars
} -returnCodes error -result {wrong # args: should be "namespacex info vars ns ?pattern?"}

test namespacex-info-vars-1.1 {namespacex info vars, wrong\#args} -body {
    namespacex info vars N P X
} -returnCodes error -result {wrong # args: should be "namespacex info vars ns ?pattern?"}

test namespacex-info-vars-2.0.0 {namespacex info vars, fqn} -setup {
    ns2_setup
} -body {
    lsort -dict [namespacex info vars ::X]
} -cleanup {
    namespace delete ::X
} -result {vXa vXb}

test namespacex-info-vars-2.0.1 {namespacex info vars, relative to global} -setup {
    ns2_setup
} -body {
    lsort -dict [namespacex info vars X]
} -cleanup {
    namespace delete ::X
} -result {vXa vXb}

test namespacex-info-vars-2.0.2 {namespacex info vars, relative to non-global} -setup {
    ns2_setup ::Q
} -body {
    namespace eval ::Q {
        lsort -dict [namespacex info vars X]
    }
} -cleanup {
    namespace delete ::Q
} -result {vXa vXb}

test namespacex-info-vars-2.1 {namespacex info vars} -setup {
    namespace eval ::X {}
} -body {
    lsort -dict [namespacex info vars ::X]
} -cleanup {
    namespace delete ::X
} -result {}

test namespacex-info-vars-2.2.0 {namespacex info vars, fqn} -setup {
    ns3_setup
} -body {
    lsort -dict [namespacex info vars ::X]
} -cleanup {
    namespace delete ::X
} -result {}

test namespacex-info-vars-2.2.1 {namespacex info vars, relative to global} -setup {
    ns3_setup
} -body {
    lsort -dict [namespacex info vars X]
} -cleanup {
    namespace delete ::X
} -result {}

test namespacex-info-vars-2.2.2 {namespacex info vars, relative to non-global} -setup {
    ns3_setup ::Q
} -body {
    namespace eval ::Q {
        lsort -dict [namespacex info vars X]
    }
} -cleanup {
    namespace delete ::Q
} -result {}

# -------------------------------------------------------------------------

test namespacex-info-allvars-1.0 {namespacex info allvars, wrong\#args} -body {
    namespacex info allvars
} -returnCodes error -result {wrong # args: should be "namespacex info allvars ns"}

test namespacex-info-allvars-1.1 {namespacex info allvars, wrong\#args} -body {
    namespacex info allvars N X
} -returnCodes error -result {wrong # args: should be "namespacex info allvars ns"}

test namespacex-info-allvars-2.0.0 {namespacex info allvars, fqn} -setup {
    ns2_setup
} -body {
    lsort -dict [namespacex info allvars ::X]
} -cleanup {
    namespace delete ::X
} -result {B::vB vXa vXb}

test namespacex-info-allvars-2.0.1 {namespacex info allvars, relative to global} -setup {
    ns2_setup
} -body {
    lsort -dict [namespacex info allvars X]
} -cleanup {
    namespace delete ::X
} -result {B::vB vXa vXb}

test namespacex-info-allvars-2.0.2 {namespacex info allvars, relative to non-global} -setup {
    ns2_setup ::Q
} -body {
    namespace eval ::Q {
        lsort -dict [namespacex info allvars X]
    }
} -cleanup {
    namespace delete ::Q
} -result {B::vB vXa vXb}

test namespacex-info-allvars-2.1.0 {namespacex info allvars, fqn} -setup {
    namespace eval ::X {}
} -body {
    lsort -dict [namespacex info allvars ::X]
} -cleanup {
    namespace delete ::X
} -result {}

test namespacex-info-allvars-2.1.1 {namespacex info allvars, relative to global} -setup {
    namespace eval ::X {}
} -body {
    lsort -dict [namespacex info allvars X]
} -cleanup {
    namespace delete ::X
} -result {}

test namespacex-info-allvars-2.1.2 {namespacex info allvars, relative to non-global} -setup {
    namespace eval ::Q::X {}
} -body {
    namespace eval ::Q {
        lsort -dict [namespacex info allvars X]
    }
} -cleanup {
    namespace delete ::Q
} -result {}

test namespacex-info-allvars-2.2.0 {namespacex info allvars, fqn} -setup {
    ns3_setup
} -body {
    lsort -dict [namespacex info allvars ::X]
} -cleanup {
    namespace delete ::X
} -result {B::vB}

test namespacex-info-allvars-2.2.1 {namespacex info allvars, relative to global} -setup {
    ns3_setup
} -body {
    lsort -dict [namespacex info allvars X]
} -cleanup {
    namespace delete ::X
} -result {B::vB}

test namespacex-info-allvars-2.2.2 {namespacex info allvars, relative to non-global} -setup {
    ns3_setup ::Q
} -body {
    namespace eval ::Q {
        lsort -dict [namespacex info allvars X]
    }
} -cleanup {
    namespace delete ::Q
} -result {B::vB}

# -------------------------------------------------------------------------

test namespacex-state-get-1.0 {namespacex state get, wrong\#args} -body {
    namespacex state get
} -returnCodes error -result {wrong # args: should be "namespacex state get ns"}

test namespacex-state-get-1.1 {namespacex state get, wrong\#args} -body {
    namespacex state get N X
} -returnCodes error -result {wrong # args: should be "namespacex state get ns"}

test namespacex-state-get-2.0.0 {namespacex state get, fqn} -setup {
    ns2_setup
} -body {
    dictsort [namespacex state get ::X]
} -cleanup {
    namespace delete ::X
} -result {B::vB 3 vXa 1 vXb aleph}

test namespacex-state-get-2.0.1 {namespacex state get, relative to global} -setup {
    ns2_setup
} -body {
    dictsort [namespacex state get X]
} -cleanup {
    namespace delete ::X
} -result {B::vB 3 vXa 1 vXb aleph}

test namespacex-state-get-2.0.2 {namespacex state get, relative to non-global} -setup {
    ns2_setup ::Q
} -body {
    namespace eval ::Q {
        dictsort [namespacex state get X]
    }
} -cleanup {
    namespace delete ::Q
} -result {B::vB 3 vXa 1 vXb aleph}

test namespacex-state-get-2.1.0 {namespacex state get, fqn} -setup {
    namespace eval ::X {}
} -body {
    dictsort [namespacex state get ::X]
} -cleanup {
    namespace delete ::X
} -result {}

test namespacex-state-get-2.1.1 {namespacex state get, relative to global} -setup {
    namespace eval ::X {}
} -body {
    dictsort [namespacex state get X]
} -cleanup {
    namespace delete ::X
} -result {}

test namespacex-state-get-2.1.2 {namespacex state get, relative to non-global} -setup {
    namespace eval ::Q::X {}
} -body {
    namespace eval ::Q {
        dictsort [namespacex state get X]
    }
} -cleanup {
    namespace delete ::Q
} -result {}

test namespacex-state-get-2.2.0 {namespacex state get, fqn} -setup {
    ns3_setup
} -body {
    dictsort [namespacex state get ::X]
} -cleanup {
    namespace delete ::X
} -result {B::vB mjolnir}

test namespacex-state-get-2.2.1 {namespacex state get, relative to global} -setup {
    ns3_setup
} -body {
    dictsort [namespacex state get X]
} -cleanup {
    namespace delete ::X
} -result {B::vB mjolnir}

test namespacex-state-get-2.2.2 {namespacex state get, relative to non-global} -setup {
    ns3_setup ::Q
} -body {
    namespace eval ::Q {
        dictsort [namespacex state get X]
    }
} -cleanup {
    namespace delete ::Q
} -result {B::vB mjolnir}

# -------------------------------------------------------------------------

test namespacex-state-drop-1.0 {namespacex state drop, wrong\#args} -body {
    namespacex state drop
} -returnCodes error -result {wrong # args: should be "namespacex state drop ns"}

test namespacex-state-drop-1.1 {namespacex state drop, wrong\#args} -body {
    namespacex state drop N X
} -returnCodes error -result {wrong # args: should be "namespacex state drop ns"}

test namespacex-state-drop-2.0.0 {namespacex state drop, fqn} -setup {
    ns2_setup
} -body {
    namespacex state drop ::X
    dictsort [namespacex state get ::X]
} -cleanup {
    namespace delete ::X
} -result {}

test namespacex-state-drop-2.0.1 {namespacex state drop, relative to global} -setup {
    ns2_setup
} -body {
    namespacex state drop X
    dictsort [namespacex state get X]
} -cleanup {
    namespace delete ::X
} -result {}

test namespacex-state-drop-2.0.2 {namespacex state drop, relative to non-global} -setup {
    ns2_setup ::Q
} -body {
    namespace eval ::Q {
        namespacex state drop X
        dictsort [namespacex state get X]
    }
} -cleanup {
    namespace delete ::Q
} -result {}

test namespacex-state-drop-2.1.0 {namespacex state drop, fqn} -setup {
    namespace eval ::X {}
} -body {
    namespacex state drop X
    dictsort [namespacex state get ::X]
} -cleanup {
    namespace delete ::X
} -result {}

test namespacex-state-drop-2.1.1 {namespacex state drop, relative to global} -setup {
    namespace eval ::X {}
} -body {
    namespacex state drop X
    dictsort [namespacex state get X]
} -cleanup {
    namespace delete ::X
} -result {}

test namespacex-state-drop-2.1.2 {namespacex state drop, relative to non-global} -setup {
    namespace eval ::Q::X {}
} -body {
    namespace eval ::Q {
        namespacex state drop X
        dictsort [namespacex state get X]
    }
} -cleanup {
    namespace delete ::Q
} -result {}

test namespacex-state-drop-2.2.0 {namespacex state drop, fqn} -setup {
    ns3_setup
} -body {
    namespacex state drop X
    dictsort [namespacex state get ::X]
} -cleanup {
    namespace delete ::X
} -result {}

test namespacex-state-drop-2.2.1 {namespacex state drop, relative to global} -setup {
    ns3_setup
} -body {
    namespacex state drop X
    dictsort [namespacex state get X]
} -cleanup {
    namespace delete ::X
} -result {}

test namespacex-state-drop-2.2.2 {namespacex state drop, relative to non-global} -setup {
    ns3_setup ::Q
} -body {
    namespace eval ::Q {
        namespacex state drop X
        dictsort [namespacex state get X]
    }
} -cleanup {
    namespace delete ::Q
} -result {}

# -------------------------------------------------------------------------

test namespacex-state-set-1.0 {namespacex state set, wrong\#args} -body {
    namespacex state set
} -returnCodes error -result {wrong # args: should be "namespacex state set ns state"}

................................................................................
    namespacex state set N
} -returnCodes error -result {wrong # args: should be "namespacex state set ns state"}

test namespacex-state-set-1.2 {namespacex state set, wrong\#args} -body {
    namespacex state set N S X
} -returnCodes error -result {wrong # args: should be "namespacex state set ns state"}

test namespacex-state-set-2.0.0 {namespacex state set, fqn} -setup {
    ns2_setup
    set ST [namespacex state get ::X]
    ns3_setup
} -body {
    namespacex state set ::X $ST
    dictsort [namespacex state get ::X]
} -cleanup {
    namespace delete ::X
} -result {B::vB 3 vXa 1 vXb aleph}

test namespacex-state-set-2.0.1 {namespacex state set, relative to global} -setup {
    ns2_setup
    set ST [namespacex state get ::X]
    ns3_setup
} -body {
    namespacex state set X $ST
    dictsort [namespacex state get X]
} -cleanup {
    namespace delete ::X
} -result {B::vB 3 vXa 1 vXb aleph}

test namespacex-state-set-2.0.1 {namespacex state set, relative to non-global} -setup {
    ns2_setup
    set ST [namespacex state get ::X]
    namespace delete ::X
    ns3_setup ::Q
} -body {
    namespace eval ::Q {
        namespacex state set X $ST
        dictsort [namespacex state get X]
    }
} -cleanup {
    namespace delete ::Q
} -result {B::vB 3 vXa 1 vXb aleph}

test namespacex-state-set-2.1.0 {namespacex state set, fqn} -setup {
    ns3_setup
    set ST [namespacex state get ::X]
    ns2_setup
} -body {
    namespacex state set ::X $ST
    dictsort [namespacex state get ::X]
} -cleanup {
    namespace delete ::X
} -result {B::vB mjolnir}

test namespacex-state-set-2.1.1 {namespacex state set, relative to global} -setup {
    ns3_setup
    set ST [namespacex state get ::X]
    ns2_setup
} -body {
    namespacex state set X $ST
    dictsort [namespacex state get X]
} -cleanup {
    namespace delete ::X
} -result {B::vB mjolnir}

test namespacex-state-set-2.1.2 {namespacex state set, relative to non-global} -setup {
    ns3_setup
    set ST [namespacex state get ::X]
    namespace delete ::X
    ns2_setup ::Q
} -body {
    namespace eval ::Q {
        namespacex state set X $ST
        dictsort [namespacex state get X]
    }
} -cleanup {
    namespace delete ::Q
} -result {B::vB mjolnir}

# -------------------------------------------------------------------------
testsuiteCleanup

# Local variables:
# mode: tcl
# indent-tabs-mode: nil
# End: