1 source [file dirname [info script]]/testing.tcl
6 test debug-0.1 {debug too few args} -body {
8 } -returnCodes error -result {wrong # args: should be "debug subcommand ?...?"}
10 test debug-0.2 {debug bad option} -body {
12 } -returnCodes error -result {bad subcommand "badoption": must be exprbc, exprlen, invstr, objcount, objects, refcount, scriptlen, or show}
14 test debug-1.1 {debug refcount too few args} -body {
16 } -returnCodes error -result {wrong # args: should be "debug refcount object"}
18 test debug-1.2 {debug refcount test} -body {
22 test debug-1.3 {debug refcount too many args} -body {
24 } -returnCodes error -result {wrong # args: should be "debug refcount object"}
26 test debug-2.1 {debug objcount} -body {
27 regexp {free \d+ used \d+} [debug objcount]
30 test debug-2.2 {debug objcount too many args} -body {
32 } -returnCodes error -result {wrong # args: should be "debug objcount"}
34 test debug-3.1 {debug objects} -body {
35 expr [llength [debug objects]] > 1000
38 # does not currently check for too many args
39 test debug-3.2 {debug objects too many args} -body {
41 } -returnCodes error -result {wrong # args: should be "debug objects"}
43 test debug-4.1 {debug invstr too few args} -body {
45 } -returnCodes error -result {wrong # args: should be "debug invstr object"}
47 test debug-4.2 {debug invstr} -body {
51 test debug-4.3 {debug invstr too many args} -body {
53 } -returnCodes error -result {wrong # args: should be "debug invstr object"}
55 test debug-5.1 {debug scriptlen too few args} -body {
57 } -returnCodes error -result {wrong # args: should be "debug scriptlen script"}
59 test debug-5.2 {debug scriptlen} -body {
60 debug scriptlen {puts "hello world"}
63 test debug-5.3 {debug scriptlen too many args} -body {
65 } -returnCodes error -result {wrong # args: should be "debug scriptlen script"}
67 test debug-6.1 {debug exprlen too few args} -body {
69 } -returnCodes error -result {wrong # args: should be "debug exprlen expression"}
71 test debug-6.2 {debug exprlen} -body {
72 debug exprlen { $x + 10 }
75 test debug-6.3 {debug exprlen too many args} -body {
77 } -returnCodes error -result {wrong # args: should be "debug exprlen expression"}
79 test debug-7.1 {debug exprbc too few args} -body {
81 } -returnCodes error -result {wrong # args: should be "debug exprbc expression"}
83 test debug-7.2 {debug exprbc} -body {
86 debug exprbc { $x + 10 + 1.5 + true + [llength {{1} {2}}] + "5" + $y(z) + "\x33"}
87 } -result {+ {+ {+ {+ {+ {+ {+ {VAR x} {INT 10}} {DBL 1.5}} {BOO true}} {CMD {llength {{1} {2}}}}} {STR 5}} {ARY y(z)}} {ESC {\x33}}}
89 test debug-7.4 {debug exprbc too many args} -body {
91 } -returnCodes error -result {wrong # args: should be "debug exprbc expression"}
93 test debug-8.1 {debug show too few args} -body {
95 } -returnCodes error -result {wrong # args: should be "debug show object"}
97 test debug-8.1 {debug show} -body {
101 } -result {refcount: 2, type: list
102 chars (11): <<hello there>>
103 bytes (11): 68 65 6c 6c 6f 20 74 68 65 72 65}
105 test debug-8.3 {debug show too many args} -body {
107 } -returnCodes error -result {wrong # args: should be "debug show object"}