summaryrefslogtreecommitdiffstats
path: root/tests/interp.test
diff options
context:
space:
mode:
authorMiguel Sofer <miguel.sofer@gmail.com>2006-10-12 16:24:11 (GMT)
committerMiguel Sofer <miguel.sofer@gmail.com>2006-10-12 16:24:11 (GMT)
commit0ca2509a6a916f079e64160010f7490742df2256 (patch)
treecd07d63ecc9fba1bc2e6f48fd6da323241399436 /tests/interp.test
parent21eb34b1a7b249809c5cb3d452e39d1e1a84feeb (diff)
downloadtcl-0ca2509a6a916f079e64160010f7490742df2256.zip
tcl-0ca2509a6a916f079e64160010f7490742df2256.tar.gz
tcl-0ca2509a6a916f079e64160010f7490742df2256.tar.bz2
* generic/tclInterp.c (ApplyObjCmd):
* tests/interp.test (interp-14.5-10): made [interp alias] use the ensemble rewrite machinery to produce better error messages [Bug 1576006]
Diffstat (limited to 'tests/interp.test')
-rw-r--r--tests/interp.test89
1 files changed, 88 insertions, 1 deletions
diff --git a/tests/interp.test b/tests/interp.test
index 07e758e..90cb346 100644
--- a/tests/interp.test
+++ b/tests/interp.test
@@ -10,7 +10,7 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
-# RCS: @(#) $Id: interp.test,v 1.49 2006/10/09 19:15:44 msofer Exp $
+# RCS: @(#) $Id: interp.test,v 1.50 2006/10/12 16:24:14 msofer Exp $
if {[lsearch [namespace children] ::tcltest] == -1} {
package require tcltest 2.1
@@ -501,6 +501,93 @@ test interp-14.4 {testing interp alias - alias over master} {
interp create a
list [catch {interp alias "" a a eval} msg] $msg [info commands a]
} {1 {cannot define or rename alias "a": interpreter deleted} {}}
+test interp-14.5 {testing interp-alias: wrong # args} -body {
+ proc setx x {set x}
+ interp alias {} a {} setx
+ catch {a 1 2}
+ set ::errorInfo
+} -cleanup {
+ rename setx {}
+ rename a {}
+} -result {wrong # args: should be "a x"
+ while executing
+"a 1 2"}
+test interp-14.6 {testing interp-alias: wrong # args} -setup {
+ proc setx x {set x}
+ catch {interp delete a}
+ interp create a
+} -body {
+ interp alias a a {} setx
+ catch {a eval a 1 2}
+ set ::errorInfo
+} -cleanup {
+ rename setx {}
+ interp delete a
+} -result {wrong # args: should be "a x"
+ invoked from within
+"a 1 2"
+ invoked from within
+"a eval a 1 2"}
+test interp-14.7 {testing interp-alias: wrong # args} -setup {
+ proc setx x {set x}
+ catch {interp delete a}
+ interp create a
+} -body {
+ interp alias a a {} setx
+ a eval {
+ catch {a 1 2}
+ set ::errorInfo
+ }
+} -cleanup {
+ rename setx {}
+ interp delete a
+} -result {wrong # args: should be "a x"
+ invoked from within
+"a 1 2"}
+test interp-14.8 {testing interp-alias: error messages} -body {
+ proc setx x {return -code error x}
+ interp alias {} a {} setx
+ catch {a 1}
+ set ::errorInfo
+} -cleanup {
+ rename setx {}
+ rename a {}
+} -result {x
+ while executing
+"a 1"}
+test interp-14.9 {testing interp-alias: error messages} -setup {
+ proc setx x {return -code error x}
+ catch {interp delete a}
+ interp create a
+} -body {
+ interp alias a a {} setx
+ catch {a eval a 1}
+ set ::errorInfo
+} -cleanup {
+ rename setx {}
+ interp delete a
+} -result {x
+ invoked from within
+"a 1"
+ invoked from within
+"a eval a 1"}
+test interp-14.10 {testing interp-alias: error messages} -setup {
+ proc setx x {return -code error x}
+ catch {interp delete a}
+ interp create a
+} -body {
+ interp alias a a {} setx
+ a eval {
+ catch {a 1}
+ set ::errorInfo
+ }
+} -cleanup {
+ rename setx {}
+ interp delete a
+} -result {x
+ invoked from within
+"a 1"}
+
# part 15: testing file sharing
test interp-15.1 {testing file sharing} {