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
|
# -*- tcl -*-
# interp.test: tests for the interp alias and creation utilities
#
# Sourcing this file into Tcl runs the tests and
# generates output for errors. No output means no errors were found.
# -------------------------------------------------------------------------
source [file join \
[file dirname [file dirname [file join [pwd] [info script]]]] \
devtools testutilities.tcl]
testsNeedTcl 8.3
testsNeedTcltest 1.0
testing {
useLocal deleg_proc.tcl interp::delegate::proc
}
# -------------------------------------------------------------------------
test dproc-1.0 {wrong#args} {
catch {interp::delegate::proc} msg
set msg
} {wrong # args}
test dproc-1.1 {wrong#args} {
catch {interp::delegate::proc a} msg
set msg
} {wrong # args}
test dproc-1.2 {wrong#args} {
catch {interp::delegate::proc a b} msg
set msg
} {wrong # args}
test dproc-1.3 {wrong#args} {
catch {interp::delegate::proc a b c} msg
set msg
} {wrong # args}
test dproc-1.4 {wrong#args} {
catch {interp::delegate::proc a b c d e} msg
set msg
} {wrong # args}
# -------------------------------------------------------------------------
test dproc-2.0 {bad switch} {
catch {interp::delegate::proc -bogus} msg
set msg
} {unknown option "-bogus", expected -async}
# -------------------------------------------------------------------------
test dproc-3.0 {delegation result} {
res!
res+ \
[info commands request] \
[interp::delegate::proc request {} FOO ID] \
[info commands request]
rename request {}
res?
} {{{} request request}}
# -------------------------------------------------------------------------
test dproc-4.0 {signature} {
res!
res+ \
[interp::delegate::proc {re quest} {} COMM ID] \
[info args {re quest}] \
[info body {re quest}]
rename {re quest} {}
res?
} {{{re quest} {} {COMM send ID {re quest}}}}
test dproc-4.1 {signature} {
res!
res+ \
[interp::delegate::proc {re quest} {a b} COMM ID] \
[info args {re quest}] \
[info body {re quest}]
rename {re quest} {}
res?
} {{{re quest} {a b} {COMM send ID [list {re quest} $a $b]}}}
test dproc-4.2 {signature} {
res!
res+ \
[interp::delegate::proc {re quest} {a b args} COMM ID] \
[info args {re quest}] \
[info body {re quest}]
rename {re quest} {}
res?
} {{{re quest} {a b args} {COMM send ID [linsert $args 0 {re quest} $a $b]}}}
test dproc-4.3 {signature} {
res!
res+ \
[interp::delegate::proc {re quest} {args} COMM ID] \
[info args {re quest}] \
[info body {re quest}]
rename {re quest} {}
res?
} {{{re quest} args {COMM send ID [linsert $args 0 {re quest}]}}}
# -------------------------------------------------------------------------
test dproc-5.0 {signature} {
res!
res+ \
[interp::delegate::proc -async {re quest} {} COMM ID] \
[info args {re quest}] \
[info body {re quest}]
rename {re quest} {}
res?
} {{{re quest} {} {COMM send -async ID {re quest}}}}
test dproc-5.1 {signature} {
res!
res+ \
[interp::delegate::proc -async {re quest} {a b} COMM ID] \
[info args {re quest}] \
[info body {re quest}]
rename {re quest} {}
res?
} {{{re quest} {a b} {COMM send -async ID [list {re quest} $a $b]}}}
test dproc-5.2 {signature} {
res!
res+ \
[interp::delegate::proc -async {re quest} {a b args} COMM ID] \
[info args {re quest}] \
[info body {re quest}]
rename {re quest} {}
res?
} {{{re quest} {a b args} {COMM send -async ID [linsert $args 0 {re quest} $a $b]}}}
test dproc-5.3 {signature} {
res!
res+ \
[interp::delegate::proc -async {re quest} {args} COMM ID] \
[info args {re quest}] \
[info body {re quest}]
rename {re quest} {}
res?
} {{{re quest} args {COMM send -async ID [linsert $args 0 {re quest}]}}}
# -------------------------------------------------------------------------
testsuiteCleanup
return
|