From bf2b535e3645d67bbadc76481d3aa3c67c395cb0 Mon Sep 17 00:00:00 2001 From: ericm Date: Sun, 17 Sep 2000 22:40:40 +0000 Subject: * tests/cmdIL.test: Added a test for fix for [Bug: 6212]. * generic/tclCmdIL.c (Tcl_LsortObjCmd): Applied patch from [Bug: 6212], which corrected an error in the handling of the -index option. --- ChangeLog | 7 +++++++ generic/tclCmdIL.c | 3 +-- tests/cmdIL.test | 18 +++++++++++++++++- 3 files changed, 25 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 922faa1..b733034 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2000-09-17 Eric Melski + + * tests/cmdIL.test: Added a test for fix for [Bug: 6212]. + + * generic/tclCmdIL.c (Tcl_LsortObjCmd): Applied patch from [Bug: + 6212], which corrected an error in the handling of the -index option. + 2000-09-14 Eric Melski * doc/Alloc.3: Added entries for Tcl_AttemptAlloc, Tcl_AttempRealloc. diff --git a/generic/tclCmdIL.c b/generic/tclCmdIL.c index 5135476..4cfb5af 100644 --- a/generic/tclCmdIL.c +++ b/generic/tclCmdIL.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: tclCmdIL.c,v 1.27 2000/05/27 23:58:01 hobbs Exp $ + * RCS: @(#) $Id: tclCmdIL.c,v 1.28 2000/09/17 22:40:41 ericm Exp $ */ #include "tclInt.h" @@ -2759,7 +2759,6 @@ Tcl_LsortObjCmd(clientData, interp, objc, objv) != TCL_OK) { return TCL_ERROR; } - cmdPtr = objv[i+1]; i++; break; case 6: /* -integer */ diff --git a/tests/cmdIL.test b/tests/cmdIL.test index b4b23f0..d6f68a3 100644 --- a/tests/cmdIL.test +++ b/tests/cmdIL.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: cmdIL.test,v 1.12 2000/04/10 17:18:57 ericm Exp $ +# RCS: @(#) $Id: cmdIL.test,v 1.13 2000/09/17 22:40:41 ericm Exp $ if {[lsearch [namespace children] ::tcltest] == -1} { package require tcltest @@ -82,6 +82,22 @@ test cmdIL-1.23 {Tcl_LsortObjCmd procedure, unique sort with index} { # lsort -unique should return the last unique item lsort -unique -index 0 {{a b} {c b} {a c} {d a}} } {{a c} {c b} {d a}} +test cmdIL-1.24 {Tcl_LsortObjCmd procedure, order of -index and -command} { + catch {rename 1 ""} + proc testcmp {a b} {return [string compare $a $b]} + set l [list [list a b] [list c d]] + set result [list [catch {lsort -command testcmp -index 1 $l} msg] $msg] + rename testcmp "" + set result +} [list 0 [list [list a b] [list c d]]] +test cmdIL-1.25 {Tcl_LsortObjCmd procedure, order of -index and -command} { + catch {rename 1 ""} + proc testcmp {a b} {return [string compare $a $b]} + set l [list [list a b] [list c d]] + set result [list [catch {lsort -index 1 -command testcmp $l} msg] $msg] + rename testcmp "" + set result +} [list 0 [list [list a b] [list c d]]] # Can't think of any good tests for the MergeSort and MergeLists # procedures, except a bunch of random lists to sort. -- cgit v0.12