summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2006-02-16 20:25:05 (GMT)
committerdgp <dgp@users.sourceforge.net>2006-02-16 20:25:05 (GMT)
commit14a955c27520dbd65d0525ab0b1b3ea7c1ccc66a (patch)
treef47cd419de4ba2fadeaa1c511880e4dac7a2a28c
parent0db044ae28d427ebebd09c07b3d6212d3ee1357a (diff)
downloadtcl-14a955c27520dbd65d0525ab0b1b3ea7c1ccc66a.zip
tcl-14a955c27520dbd65d0525ab0b1b3ea7c1ccc66a.tar.gz
tcl-14a955c27520dbd65d0525ab0b1b3ea7c1ccc66a.tar.bz2
* generic/tclIndexObj.c: Disallow the "ambiguous" error message
* tests/indexObj.test: when TCL_EXACT matching is requested. * tests/ioCmd.test:
-rw-r--r--ChangeLog6
-rw-r--r--generic/tclIndexObj.c6
-rw-r--r--tests/indexObj.test5
-rw-r--r--tests/ioCmd.test6
4 files changed, 16 insertions, 7 deletions
diff --git a/ChangeLog b/ChangeLog
index 873267b..25ed4b6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2006-02-16 Don Porter <dgp@users.sourceforge.net>
+
+ * generic/tclIndexObj.c: Disallow the "ambiguous" error message
+ * tests/indexObj.test: when TCL_EXACT matching is requested.
+ * tests/ioCmd.test:
+
2006-02-15 Don Porter <dgp@users.sourceforge.net>
* generic/tclIO.c: Made several routines tolerant of
diff --git a/generic/tclIndexObj.c b/generic/tclIndexObj.c
index 0b5401d..c9f8e1d 100644
--- a/generic/tclIndexObj.c
+++ b/generic/tclIndexObj.c
@@ -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: tclIndexObj.c,v 1.27 2005/11/01 15:30:52 dkf Exp $
+ * RCS: @(#) $Id: tclIndexObj.c,v 1.28 2006/02/16 20:25:07 dgp Exp $
*/
#include "tclInt.h"
@@ -270,8 +270,8 @@ Tcl_GetIndexFromObjStruct(
TclNewObj(resultPtr);
Tcl_SetObjResult(interp, resultPtr);
- Tcl_AppendStringsToObj(resultPtr,
- (numAbbrev > 1) ? "ambiguous " : "bad ", msg, " \"", key,
+ Tcl_AppendStringsToObj(resultPtr, (numAbbrev > 1) &&
+ !(flags & TCL_EXACT) ? "ambiguous " : "bad ", msg, " \"", key,
"\": must be ", STRING_AT(tablePtr, offset, 0), NULL);
for (entryPtr = NEXT_ENTRY(tablePtr, offset), count = 0;
*entryPtr != NULL;
diff --git a/tests/indexObj.test b/tests/indexObj.test
index 7fea854..ca58cc3 100644
--- a/tests/indexObj.test
+++ b/tests/indexObj.test
@@ -8,7 +8,7 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
-# RCS: @(#) $Id: indexObj.test,v 1.9 2004/11/25 16:37:15 dkf Exp $
+# RCS: @(#) $Id: indexObj.test,v 1.10 2006/02/16 20:25:07 dgp Exp $
if {[lsearch [namespace children] ::tcltest] == -1} {
package require tcltest
@@ -54,6 +54,9 @@ test indexObj-2.4 {ambiguous value} testindexobj {
test indexObj-2.5 {omit error message} testindexobj {
list [catch {testindexobj 0 1 d x} msg] $msg
} {1 {}}
+test indexObj-2.6 {TCL_EXACT => no "ambiguous" error message} {
+ list [catch {testindexobj 1 0 d dumb daughter a c} msg] $msg
+} {1 {bad token "d": must be dumb, daughter, a, or c}}
test indexObj-3.1 {cache result to skip next lookup} testindexobj {
testindexobj check 42
diff --git a/tests/ioCmd.test b/tests/ioCmd.test
index 7c018ae..b33c659 100644
--- a/tests/ioCmd.test
+++ b/tests/ioCmd.test
@@ -13,7 +13,7 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
-# RCS: @(#) $Id: ioCmd.test,v 1.25 2005/10/31 13:53:33 dkf Exp $
+# RCS: @(#) $Id: ioCmd.test,v 1.26 2006/02/16 20:25:07 dgp Exp $
if {[lsearch [namespace children] ::tcltest] == -1} {
package require tcltest 2
@@ -665,12 +665,12 @@ test iocmd-21.11 {chan create, initialize failed, bad result, bogus method name}
rename foo {}
set msg
} {Initialize failure: bad method "1": must be blocking, cget, cgetall, configure, finalize, initialize, read, seek, watch, or write}
-test iocmd-21.12 {chan create, initialize failed, bad result, ambiguous method name} {
+test iocmd-21.12 {chan create, initialize failed, bad result, bogus method name} {
proc foo {args} {return {a b c}}
catch {chan create {r w} foo} msg
rename foo {}
set msg
-} {Initialize failure: ambiguous method "c": must be blocking, cget, cgetall, configure, finalize, initialize, read, seek, watch, or write}
+} {Initialize failure: bad method "c": must be blocking, cget, cgetall, configure, finalize, initialize, read, seek, watch, or write}
test iocmd-21.13 {chan create, initialize failed, bad result, required methods missing} {
proc foo {args} {return {initialize finalize}}
catch {chan create {r w} foo} msg