summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2006-02-16 20:21:54 (GMT)
committerdgp <dgp@users.sourceforge.net>2006-02-16 20:21:54 (GMT)
commit516bd8eecdd1a001de9d6aff3e7ea01460b357b8 (patch)
tree3d05db661c9d68e583b5f4ee2bb5d305890088b6
parent8a69941cbf07e009343850ef3a370bcc7adf4f7e (diff)
downloadtcl-516bd8eecdd1a001de9d6aff3e7ea01460b357b8.zip
tcl-516bd8eecdd1a001de9d6aff3e7ea01460b357b8.tar.gz
tcl-516bd8eecdd1a001de9d6aff3e7ea01460b357b8.tar.bz2
* generic/tclIndexObj.c: Disallow the "ambiguous" error message
* generic/indexObj.test: when TCL_EXACT matching is requested.
-rw-r--r--ChangeLog5
-rw-r--r--generic/tclIndexObj.c6
-rw-r--r--tests/indexObj.test5
3 files changed, 12 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index ce43d9c..7cfd7dc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2006-02-16 Don Porter <dgp@users.sourceforge.net>
+
+ * generic/tclIndexObj.c: Disallow the "ambiguous" error message
+ * generic/indexObj.test: when TCL_EXACT matching is requested.
+
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 60d4931..bdfca15 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.16.2.1 2004/01/13 09:45:30 dkf Exp $
+ * RCS: @(#) $Id: tclIndexObj.c,v 1.16.2.2 2006/02/16 20:21:54 dgp Exp $
*/
#include "tclInt.h"
@@ -274,8 +274,8 @@ Tcl_GetIndexFromObjStruct(interp, objPtr, tablePtr, offset, msg, flags,
TclNewObj(resultPtr);
Tcl_SetObjResult(interp, resultPtr);
- Tcl_AppendStringsToObj(resultPtr,
- (numAbbrev > 1) ? "ambiguous " : "bad ", msg, " \"",
+ Tcl_AppendStringsToObj(resultPtr, (numAbbrev > 1) &&
+ !(flags & TCL_EXACT) ? "ambiguous " : "bad ", msg, " \"",
key, "\": must be ", STRING_AT(tablePtr,offset,0), (char*)NULL);
for (entryPtr = NEXT_ENTRY(tablePtr, offset), count = 0;
*entryPtr != NULL;
diff --git a/tests/indexObj.test b/tests/indexObj.test
index 9a8a582..dee0dfa 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.7 2000/11/24 11:27:38 dkf Exp $
+# RCS: @(#) $Id: indexObj.test,v 1.7.18.1 2006/02/16 20:21:54 dgp Exp $
if {[lsearch [namespace children] ::tcltest] == -1} {
package require tcltest
@@ -59,6 +59,9 @@ test indexObj-2.4 {ambiguous value} {
test indexObj-2.5 {omit error message} {
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 check 42