summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
Diffstat (limited to 'generic')
-rw-r--r--generic/tclTest.c36
1 files changed, 35 insertions, 1 deletions
diff --git a/generic/tclTest.c b/generic/tclTest.c
index 4867e1c..fc0356f 100644
--- a/generic/tclTest.c
+++ b/generic/tclTest.c
@@ -14,7 +14,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclTest.c,v 1.81 2004/04/06 22:25:55 dgp Exp $
+ * RCS: @(#) $Id: tclTest.c,v 1.82 2004/05/19 10:38:24 dkf Exp $
*/
#define TCL_TEST
@@ -257,6 +257,8 @@ static int TestfeventCmd _ANSI_ARGS_((ClientData dummy,
Tcl_Interp *interp, int argc, CONST char **argv));
static int TestgetassocdataCmd _ANSI_ARGS_((ClientData dummy,
Tcl_Interp *interp, int argc, CONST char **argv));
+static int TestgetintCmd _ANSI_ARGS_((ClientData dummy,
+ Tcl_Interp *interp, int argc, CONST char **argv));
static int TestgetplatformCmd _ANSI_ARGS_((ClientData dummy,
Tcl_Interp *interp, int argc, CONST char **argv));
static int TestgetvarfullnameCmd _ANSI_ARGS_((
@@ -634,6 +636,8 @@ Tcltest_Init(interp)
(Tcl_CmdDeleteProc *) NULL);
Tcl_CreateCommand(interp, "testgetassocdata", TestgetassocdataCmd,
(ClientData) 0, (Tcl_CmdDeleteProc *) NULL);
+ Tcl_CreateCommand(interp, "testgetint", TestgetintCmd,
+ (ClientData) 0, (Tcl_CmdDeleteProc *) NULL);
Tcl_CreateCommand(interp, "testgetplatform", TestgetplatformCmd,
(ClientData) 0, (Tcl_CmdDeleteProc *) NULL);
Tcl_CreateObjCommand(interp, "testgetvarfullname",
@@ -6604,3 +6608,33 @@ TestHashSystemHashCmd(clientData, interp, objc, objv)
Tcl_AppendResult(interp, "OK", NULL);
return TCL_OK;
}
+
+/*
+ * Used for testing Tcl_GetInt which is no longer used directly by the
+ * core very much.
+ */
+static int
+TestgetintCmd(dummy, interp, argc, argv)
+ ClientData dummy;
+ Tcl_Interp *interp;
+ int argc;
+ CONST char **argv;
+{
+ if (argc < 2) {
+ Tcl_SetResult(interp, "wrong # args", TCL_STATIC);
+ return TCL_ERROR;
+ } else {
+ int val,i,total=0;
+ char buf[TCL_INTEGER_SPACE];
+
+ for (i=1 ; i<argc ; i++) {
+ if (Tcl_GetInt(interp, argv[i], &val) != TCL_OK) {
+ return TCL_ERROR;
+ }
+ total += val;
+ }
+ TclFormatInt(buf, total);
+ Tcl_SetResult(interp, buf, TCL_VOLATILE);
+ return TCL_OK;
+ }
+}