File: typeinfo.test

package info (click to toggle)
itcl4 4.3.5-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,512 kB
  • sloc: ansic: 25,739; tcl: 1,705; sh: 452; makefile: 68
file content (1210 lines) | stat: -rw-r--r-- 24,512 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
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
509
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
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
#---------------------------------------------------------------------
# TITLE:
#       typeoption.test
#
# AUTHOR:
#       Arnulf Wiedemann with a lot of code form the snit tests by
#       Will Duquette
#
# DESCRIPTION:
#       Test cases for ::itcl::type proc, method, typemethod commands.
#       Uses the ::tcltest:: harness.
#
#    The tests assume tcltest 2.2
#-----------------------------------------------------------------------

package require tcltest 2.2
namespace import ::tcltest::*
::tcltest::loadTestedCommands
package require itcl

interp alias {} type {} ::itcl::type

loadTestedCommands

#-----------------------------------------------------------------------
# Instance Introspection

test iinfo-1.2 {object info too few args} -body {
    type dog { }

    dog create spot

    spot info
} -returnCodes {
    error
} -cleanup {
    dog destroy
} -result {wrong # args: should be one of...
  info args procname
  info body procname
  info component ?name? ?-inherit? ?-value?
  info components ?pattern?
  info default method aname varname
  info delegated ?name? ?-inherit? ?-value?
  info instances ?pattern?
  info method ?name? ?-protection? ?-type? ?-name? ?-args? ?-body?
  info methods ?pattern?
  info options ?pattern?
  info type
  info typemethod ?name? ?-protection? ?-type? ?-name? ?-args? ?-body?
  info typemethods ?pattern?
  info types ?pattern?
  info typevariable ?name? ?-protection? ?-type? ?-name? ?-init? ?-value?
  info typevars ?pattern?
  info variable ?name? ?-protection? ?-type? ?-name? ?-init? ?-value? ?-config? ?-scope?
  info variables ?pattern?
...and others described on the man page}

test iinfo-1.3 {object info too many args} -body {
    type dog { }

    dog create spot

    spot info type foo
} -returnCodes {
    error
} -cleanup {
    dog destroy
} -result {wrong # args: should be "info type"}

test iinfo-2.1 {object info type} -body {
    type dog { }

    dog create spot
    spot info type
} -cleanup {
    dog destroy
} -result {::dog}

test iinfo-3.1 {object info typevars} -body {
    type dog {
	typevariable thisvar 1
	typevariable thatvar 2

	constructor {args} {
	}
    }

    dog create spot
    lsort [spot info typevars]
} -cleanup {
    dog destroy
} -result {::dog::thatvar ::dog::thisvar}

test iinfo-3.2 {object info typevars with pattern} -body {
    type dog {
	typevariable thisvar 1
	typevariable thatvar 2

	constructor {args} {
	}
    }

    dog create spot
    spot info typevars *this*
} -cleanup {
    dog destroy
} -result {::dog::thisvar}

test iinfo-3.1a {object info typevarable} -body {
    type dog {
	typevariable thisvar 1
	typevariable thatvar 2

	constructor {args} {
	}
    }

    dog create spot
    spot info typevariable thatvar -name -protection -type -init -value
} -cleanup {
    dog destroy
} -result {::dog::thatvar public common 2 2}

test iinfo-4.1 {object info vars} -body {
    type dog {
	variable hisvar 1

	constructor {args} {
	    variable hervar
	    set hervar 2
	}
    }

    dog create spot
    lsort [spot info vars]
} -cleanup {
    dog destroy
} -result {hisvar itcl_options}

test iinfo-4.2 {object info vars with pattern} -body {
    type dog {
	variable hisvar 1

	constructor {args} {
	    variable hervar
	    set hervar 2
	}
    }

    dog create spot
    spot info vars "*his*"
} -cleanup {
    dog destroy
} -result {hisvar itcl_options}

test iinfo-5.1 {object info no vars defined besides itcl_options} -body {
    type dog { }

    dog create spot
    list [spot info vars] [spot info typevars]
} -cleanup {
    dog destroy
} -result {itcl_options {}}

test iinfo-6.1 {info options with no options} -body {
    type dog { }
    dog create spot

    llength [spot info options]
} -cleanup {
    dog destroy
} -result {0}

test iinfo-6.2 {info options with only local options} -body {
    type dog {
	option -foo a
	option -bar b
    }
    dog create spot

    lsort [spot info options]
} -cleanup {
    dog destroy
} -result {-bar -foo}

test iinfo-6.3 {info options with local and delegated options} -body {
    type dog {
	option -foo a
	option -bar b
	delegate option -quux to sibling
    }
    dog create spot

    lsort [spot info options]
} -cleanup {
    dog destroy
} -result {-bar -foo -quux}

test iinfo-6.3a {info option} -body {
    type dog {
	option -foo a
	option -bar b
	delegate option -quux to sibling
    }
    dog create spot

    lsort [spot info option]
} -cleanup {
    dog destroy
} -result {-bar -foo}

test iinfo-6.3b {info option with options} -body {
    type dog {
	option -foo -cgetmethod xx -configuremethodvar yy -default a
	option -bar b
	delegate option -quux to sibling
    }
    dog create spot

    spot info option -foo
} -cleanup {
    dog destroy
} -result {protected ::dog::-foo foo Foo a xx {} {} yy}

test iinfo-7.1 {info typemethods, simple case} -body {
    type dog { }

    dog spot

    lsort [spot info typemethods]
} -cleanup {
    dog destroy
} -result {create destroy info}

test iinfo-7.2 {info typemethods, with pattern} -body {
    type dog { }

    dog spot

    spot info typemethods i*
} -cleanup {
    dog destroy
} -result {info}

test iinfo-7.3 {info typemethods, with explicit typemethods} -body {
    type dog {
	typemethod foo {} {}
	typeconstructor {
	    set comp string
	}
	delegate typemethod bar to comp
    }

    dog spot

    lsort [spot info typemethods]
} -cleanup {
    dog destroy
} -result {bar create destroy foo info}

test iinfo-7.4 {info typemethods, with implicit typemethods} -body {
    type dog {
	delegate typemethod * to comp

	typeconstructor {
	    set comp string
	}
    }

    dog create spot

    set a [lsort [spot info typemethods]]

    dog length foo
    dog is boolean yes

    set b [lsort [spot info typemethods]]

    set c [spot info typemethods len*]

    list $a $b $c
} -cleanup {
    dog destroy
} -result {{create destroy info} {create destroy info is length} length}

test iinfo-7.5 {info typemethods, with hierarchical typemethods} -body {
    type dog {
	delegate typemethod {comp foo} to comp

	typeconstructor {
	    set comp string
	}
	typemethod {comp bar} {} {}
    }

    dog create spot

    lsort [spot info typemethods]
} -cleanup {
    dog destroy
} -result {{comp bar} {comp foo} create destroy info}

test iinfo-7.5a {info typemethod} -body {
    type dog {
	typemethod tail {args} { set a b }
    }

    dog create spot

    lsort [spot info typemethod]
} -cleanup {
    dog destroy
} -result {::dog::tail}

test iinfo-7.5b {info typemethod with options} -body {
    type dog {
	typemethod tail {args} { set a b }
    }

    dog create spot

    spot info typemethod tail -name -protection -args -body -type
} -cleanup {
    dog destroy
} -result {::dog::tail public {?arg arg ...?} { set a b } typemethod}


test iinfo-8.1 {info methods, simple case} -body {
    type dog { }

    dog spot

    lsort [spot info methods]
} -cleanup {
    dog destroy
} -result {destroy info}

test iinfo-8.2 {info methods, with pattern} -body {
    type dog { }

    dog spot

    spot info methods i*
} -cleanup {
    dog destroy
} -result {info}

test iinfo-8.1a {info method} -body {
    type dog {
	method tail {args} { set a b }
    }

    dog spot

    lsort [spot info method]
} -cleanup {
    dog destroy
} -result {::dog::callinstance ::dog::cget ::dog::configure ::dog::destroy ::dog::getinstancevar ::dog::info ::dog::isa ::dog::mymethod ::dog::myproc ::dog::mytypemethod ::dog::mytypevar ::dog::myvar ::dog::tail ::dog::unknown}

test iinfo-8.1b {info method with options} -body {
    type dog {
	method tail {args} { set a b }
    }

    dog spot

    spot info method tail -name -protection -args -body -type
} -cleanup {
    dog destroy
} -result {::dog::tail public {?arg arg ...?} { set a b } method}

test iinfo-8.3 {info methods, with explicit methods} -body {
    type dog {
	method foo {} {}
	typeconstructor {
	    set comp string
	}
	delegate method bar to comp
    }

    dog spot

    lsort [spot info methods]
} -cleanup {
    dog destroy
} -result {bar destroy foo info}

test iinfo-8.4 {info methods, with implicit methods} -body {
    type dog {
	delegate method * to comp

	constructor {args} {
	    set comp string
	}
    }

    dog create spot

    set a [lsort [spot info methods]]

    spot length foo
    spot is boolean yes

    set b [lsort [spot info methods]]

    set c [spot info methods len*]

    list $a $b $c
} -cleanup {
    dog destroy
} -result {{destroy info} {destroy info is length} length}

test iinfo-8.5 {info methods, with hierarchical methods} -body {
    type dog {
	delegate method {comp foo} to comp

	constructor {args} {
	    set comp string
	}
	method {comp bar} {} {}
    }

    dog create spot

    lsort [spot info methods]
} -cleanup {
    dog destroy
} -result {{comp bar} {comp foo} destroy info}

test iinfo-9.1 {info args} -body {
    type dog {
	method bark {volume} {}
    }

    dog spot

    spot info args bark
} -cleanup {
    dog destroy
} -result {volume}

test iinfo-9.2 {info args, too few args} -body {
    type dog {
	method bark {volume} {}
    }

    dog spot

    spot info args
} -returnCodes error -cleanup {
    dog destroy
} -result {wrong # args: should be "info args method"}

test iinfo-9.3 {info args, too many args} -body {
    type dog {
	method bark {volume} {}
    }

    dog spot

    spot info args bark wag
} -returnCodes error -cleanup {
    dog destroy
} -result {wrong # args: should be "info args method"}

test iinfo-9.4 {info args, unknown method} -body {
    type dog {
    }

    dog spot

    spot info args bark
} -returnCodes error -cleanup {
    dog destroy
} -result {"bark" isn't a method}

test iinfo-9.5 {info args, delegated method} -body {
    type dog {
	component x
	typeconstructor {
	    set x string
	}
	delegate method bark to x
    }

    dog spot

    spot info args bark
} -returnCodes error -cleanup {
    dog destroy
} -result {delegated method "bark"}

test iinfo-10.1 {info default} -body {
    type dog {
	method bark {{volume 50}} {}
    }

    dog spot

    list [spot info default bark volume def] $def
} -cleanup {
    dog destroy
} -result {1 50}

test iinfo-10.2 {info default, too few args} -body {
    type dog {
	method bark {volume} {}
    }

    dog spot

    spot info default
} -returnCodes error -cleanup {
    dog destroy
} -result {wrong # args, should be info default <method> <argName> <varName>}

test iinfo-10.3 {info default, too many args} -body {
    type dog {
	method bark {volume} {}
    }

    dog spot

    spot info default bark wag def foo
} -returnCodes error -cleanup {
    dog destroy
} -result {wrong # args, should be info default <method> <argName> <varName>}

test iinfo-10.4 {info default, unknown method} -body {
    type dog {
    }

    dog spot

    spot info default bark x var
} -returnCodes error -cleanup {
    dog destroy
} -result {unknown method "bark"}

test iinfo-10.5 {info default, delegated method} -body {
    type dog {
	component x
	typeconstructor {
	    set x string
	}
	delegate method bark to x
    }

    dog spot

    spot info default bark x var
} -returnCodes error -cleanup {
    dog destroy
} -result {delegated method "bark"}

test iinfo-11.1 {info body} -body {
    type dog {
	typevariable x
	variable y
	method bark {volume} {
	    speaker on
	    speaker play bark.snd
	    speaker off
	}
    }

    dog spot

    spot info body bark
} -cleanup {
    dog destroy
} -result {
	    speaker on
	    speaker play bark.snd
	    speaker off
	}

test iinfo-11.2 {info body, too few args} -body {
    type dog {
	method bark {volume} {}
    }

    dog spot

    spot info body
} -returnCodes error -cleanup {
    dog destroy
} -result {wrong # args: should be "info body method"}

test iinfo-11.3 {info body, too many args} -body {
    type dog {
	method bark {volume} {}
    }

    dog spot

    spot info body bark wag
} -returnCodes error -cleanup {
    dog destroy
} -result {wrong # args: should be "info body method"}

test iinfo-11.4 {info body, unknown method} -body {
    type dog {
    }

    dog spot

    spot info body bark
} -returnCodes error -cleanup {
    dog destroy
} -result {"bark" isn't a method}

test iinfo-11.5 {info body, delegated method} -body {
    type dog {
	component x
	typeconstructor {
	    set x string
	}
	delegate method bark to x
    }

    dog spot

    spot info body bark
} -returnCodes error -cleanup {
    dog destroy
} -result {delegated method "bark"}

#-----------------------------------------------------------------------
# Type Introspection

test tinfo-1.2 {type info too few args} -body {
    type dog { }

    dog info
} -returnCodes {
    error
} -cleanup {
    dog destroy
} -result {wrong # args: should be one of...
  info args procname
  info body procname
  info component ?name? ?-inherit? ?-value?
  info components ?pattern?
  info default method aname varname
  info delegated ?name? ?-inherit? ?-value?
  info instances ?pattern?
  info method ?name? ?-protection? ?-type? ?-name? ?-args? ?-body?
  info methods ?pattern?
  info options ?pattern?
  info type
  info typemethod ?name? ?-protection? ?-type? ?-name? ?-args? ?-body?
  info typemethods ?pattern?
  info types ?pattern?
  info typevariable ?name? ?-protection? ?-type? ?-name? ?-init? ?-value?
  info typevars ?pattern?
  info variable ?name? ?-protection? ?-type? ?-name? ?-init? ?-value? ?-config? ?-scope?
  info variables ?pattern?
...and others described on the man page}


test tinfo-1.3 {type info too many args} -body {
    type dog { }

    dog info instances foo bar
} -returnCodes {
    error
} -cleanup {
    dog destroy
} -result {wrong # args should be: info instances ?pattern?}

test tinfo-2.1 {type info typevars} -body {
    type dog {
	typevariable thisvar 1
	typevariable thatvar 2

	constructor {args} {
	}
    }

    dog create spot
    lsort [dog info typevars]
} -cleanup {
    dog destroy
} -result {::dog::thatvar ::dog::thisvar}

test tinfo-3.1 {type info instances} -body {
    type dog { }

    dog create spot
    dog create fido

    lsort [dog info instances]
} -cleanup {
    dog destroy
} -result {::fido ::spot}

test tinfo-3.3 {type info instances with non-global namespaces} -body {
    type dog { }

    dog create ::spot

    namespace eval ::dogs:: {
	set ::qname [dog create fido]
    }

    list $qname [lsort [dog info instances]]
} -cleanup {
    dog destroy
} -result {::dogs::fido {::dogs::fido ::spot}}

test tinfo-3.4 {type info instances with pattern} -body {
    type dog { }

    dog create spot
    dog create fido

    dog info instances "*f*"
} -cleanup {
    dog destroy
} -result {::fido}

test tinfo-4.1 {type info typevars with pattern} -body {
    type dog {
	typevariable thisvar 1
	typevariable thatvar 2

	constructor {args} {
	}
    }

    dog create spot
    dog info typevars *this*
} -cleanup {
    dog destroy
} -result {::dog::thisvar}

test tinfo-5.1 {type info typemethods, simple case} -body {
    type dog { }

    lsort [dog info typemethods]
} -cleanup {
    dog destroy
} -result {create destroy info}

test tinfo-5.2 {type info typemethods, with pattern} -body {
    type dog { }

    dog info typemethods i*
} -cleanup {
    dog destroy
} -result {info}

test tinfo-5.3 {type info typemethods, with explicit typemethods} -body {
    type dog {
	typemethod foo {} {}
	typeconstructor {
	    set comp string
	}
	delegate typemethod bar to comp
    }

    lsort [dog info typemethods]
} -cleanup {
    dog destroy
} -result {bar create destroy foo info}

test tinfo-5.4 {type info typemethods, with implicit typemethods} -body {
    type dog {
	delegate typemethod * to comp

	typeconstructor {
	    set comp string
	}
    }

    set a [lsort [dog info typemethods]]

    dog length foo
    dog is boolean yes

    set b [lsort [dog info typemethods]]

    set c [dog info typemethods len*]

    list $a $b $c
} -cleanup {
    dog destroy
} -result {{create destroy info} {create destroy info is length} length}

test tinfo-5.5 {info typemethods, with hierarchical typemethods} -body {
    type dog {
	delegate typemethod {comp foo} to comp

	typeconstructor {
	    set comp string
	}
	typemethod {comp bar} {} {}
    }

    lsort [dog info typemethods]
} -cleanup {
    dog destroy
} -result {{comp bar} {comp foo} create destroy info}

test tinfo-6.1 {type info args} -body {
    type dog {
	typemethod bark {volume} {}
    }

    dog info args bark
} -cleanup {
    dog destroy
} -result {volume}

test tinfo-6.2 {type info args, too few args} -body {
    type dog {
	typemethod bark {volume} {}
    }

    dog info args
} -returnCodes error -cleanup {
    dog destroy
} -result {wrong # args: should be "info args method"}

test tinfo-6.3 {type info args, too many args} -body {
    type dog {
	typemethod bark {volume} {}
    }

    dog info args bark wag
} -returnCodes error -cleanup {
    dog destroy
} -result {wrong # args: should be "info args method"}

test tinfo-6.4 {type info args, unknown method} -body {
    type dog {
    }

    dog info args bark
} -returnCodes error -cleanup {
    dog destroy
} -result {"bark" isn't a method}

test tinfo-6.5 {type info args, delegated method} -body {
    type dog {
	typeconstructor {
	    set x string
	}
	delegate typemethod bark to x
    }

    dog info args bark
} -returnCodes error -cleanup {
    dog destroy
} -result {delegated typemethod "bark"}

test tinfo-7.1 {type info default} -body {
    type dog {
	typemethod bark {{volume 50}} {}
    }

    list [dog info default bark volume def] $def
} -cleanup {
    dog destroy
} -result {1 50}

test tinfo-7.2 {type info default, too few args} -body {
    type dog {
	typemethod bark {volume} {}
    }

    dog info default
} -returnCodes error -cleanup {
    dog destroy
} -result {wrong # args, should be info default <method> <argName> <varName>}

test tinfo-7.3 {type info default, too many args} -body {
    type dog {
	typemethod bark {volume} {}
    }

    dog info default bark wag def foo
} -returnCodes error -cleanup {
    dog destroy
} -result {wrong # args, should be info default <method> <argName> <varName>}

test tinfo-7.4 {type info default, unknown method} -body {
    type dog {
    }

    dog info default bark x var
} -returnCodes error -cleanup {
    dog destroy
} -result {unknown method "bark"}

test tinfo-7.5 {type info default, delegated method} -body {
    type dog {
	typeconstructor {
	    set x string
	}
	delegate typemethod bark to x
    }

    dog info default bark x var
} -returnCodes error -cleanup {
    dog destroy
} -result {delegated typemethod "bark"}

test tinfo-8.1 {type info body} -body {
    type dog {
	typevariable x
	variable y
	typemethod bark {volume} {
	    speaker on
	    speaker play bark.snd
	    speaker off
	}
    }

    dog info body bark
} -cleanup {
    dog destroy
} -result {
	    speaker on
	    speaker play bark.snd
	    speaker off
	}

test tinfo-8.2 {type info body, too few args} -body {
    type dog {
	typemethod bark {volume} {}
    }

    dog info body
} -returnCodes error -cleanup {
    dog destroy
} -result {wrong # args: should be "info body method"}

test tinfo-8.3 {type info body, too many args} -body {
    type dog {
	typemethod bark {volume} {}
    }

    dog info body bark wag
} -returnCodes error -cleanup {
    dog destroy
} -result {wrong # args: should be "info body method"}

test tinfo-8.4 {type info body, unknown method} -body {
    type dog {
    }

    dog info body bark
} -returnCodes error -cleanup {
    dog destroy
} -result {"bark" isn't a method}

test tinfo-8.5 {type info body, delegated method} -body {
    type dog {
	typeconstructor {
	    set x string
	}
	delegate typemethod bark to x
    }

    dog info body bark
} -returnCodes {
    error
}  -cleanup {
    dog destroy
} -result {delegated typemethod "bark"}

test tinfo-10.1 {type info types} -body {
    type dog {
    }

    type cat {
    }

    lsort [dog info types]
} -cleanup {
    dog destroy
    cat destroy
} -result {cat dog}

test tinfo-10.2 {type info components} -body {
    type dog {
	component comp1
	component comp2
    }

    type cat {
	component comp1
	component comp1a
    }

    set a [lsort [dog info components]]
    set b [lsort [cat info components]]
    list $a $b
} -cleanup {
    dog destroy
    cat destroy
} -result {{comp1 comp2} {comp1 comp1a}}

test tinfo-10.2a {type info component} -body {
    type dog {
	component comp1
	component comp2
    }

    type cat {
	component comp1
	component comp1a
    }

    set a [lsort [dog info component]]
    set b [lsort [cat info component]]
    list $a $b
} -cleanup {
    dog destroy
    cat destroy
} -result {{::dog::comp1 ::dog::comp2} {::cat::comp1 ::cat::comp1a}}

test tinfo-10.2b {type info component with options} -body {
    type dog {
	component comp1
	component comp2
    }

    dog info component comp1 -name -inherit
} -cleanup {
    dog destroy
} -result {::dog::comp1 0}

test tinfo-10.4 {type info delegated methods} -body {
    type dog {
    }


    dog info delegated xxx
} -returnCodes {
    error
} -cleanup {
    dog destroy
} -result {wrong # args: should be one of...
  info methods ?pattern?
  info typemethods ?pattern?
  info options ?pattern?
...and others described on the man page}

test tinfo-10.5 {type info delegated methods} -body {
    type dog {
	component comp1
	component comp2
	delegate method wag to comp1
	delegate method tail to comp2
	delegate typemethod typewag to comp1
	delegate typemethod typetail to comp2
	typeconstructor {
	    set comp1 string
	    set comp2 string
	}
    }


    lsort [dog info delegated methods]
} -cleanup {
    dog destroy
} -result {{tail comp2} {wag comp1}}

test tinfo-10.5a {type info delegated method} -body {
    type dog {
	component comp1
	component comp2
	delegate method wag to comp1
	delegate method tail to comp2
	delegate typemethod typewag to comp1
	delegate typemethod typetail to comp2
	typeconstructor {
	    set comp1 string
	    set comp2 string
	}
    }


    lsort [dog info delegated method]
} -cleanup {
    dog destroy
} -result {tail wag}

test tinfo-10.5b {type info delegated method with options} -body {
    type dog {
	component comp1
	component comp2
	delegate method wag to comp1
	delegate method tail to comp2
	delegate typemethod typewag to comp1
	delegate typemethod typetail to comp2
	typeconstructor {
	    set comp1 string
	    set comp2 string
	}
    }


    dog info delegated method wag -name -component -using -as -exceptions
} -cleanup {
    dog destroy
} -result {wag comp1 {} {} {}}

test tinfo-10.5c {type info delegated typemethod} -body {
    type dog {
	component comp1
	component comp2
	delegate method wag to comp1
	delegate method tail to comp2
	delegate typemethod typewag to comp1
	delegate typemethod typetail to comp2
	typeconstructor {
	    set comp1 string
	    set comp2 string
	}
    }


    lsort [dog info delegated typemethod]
} -cleanup {
    dog destroy
} -result {typetail typewag}

test tinfo-10.5d {type info delegated typemethod with options} -body {
    type dog {
	component comp1
	component comp2
	delegate method wag to comp1
	delegate method tail to comp2
	delegate typemethod typewag to comp1
	delegate typemethod typetail to comp2
	typeconstructor {
	    set comp1 string
	    set comp2 string
	}
    }


    dog info delegated typemethod typewag -name -component -using -as -exceptions
} -cleanup {
    dog destroy
} -result {typewag comp1 {} {} {}}

test tinfo-10.6 {type info delegated typemethods} -body {
    type dog {
	component comp1
	component comp2
	delegate method wag to comp1
	delegate method tail to comp2
	delegate typemethod typewag to comp1
	delegate typemethod typetail to comp2
	typeconstructor {
	    set comp1 string
	    set comp2 string
	}
    }


    lsort [dog info delegated typemethods]
} -cleanup {
    dog destroy
} -result {{typetail comp2} {typewag comp1}}

test tinfo-10.7 {type info delegated options} -body {
    type dog {
	component comp1
	component comp2
	component comp3
	delegate option -foo to comp1
	delegate option -bar to comp2
	delegate option * to comp3
	typeconstructor {
	    set comp1 string
	    set comp2 string
	    set comp3 string
	}
    }


    lsort [dog info delegated options]
} -cleanup {
    dog destroy
} -result {{* comp3} {-bar comp2} {-foo comp1}}

test tinfo-11.1 {type info type} -body {
    type dog {
	typeconstructor {
	}
    }

    dog info type
} -cleanup {
    dog destroy
} -result {::dog}


#---------------------------------------------------------------------
# Clean up

cleanupTests
return