Tk Library Source Code

Artifact [a8d8af149d]
Login

Artifact a8d8af149d39c59e928efa6d16a0c922bc5055aa:

Attachment "fix.diff" to ticket [3308051fff] added by anonymous 2011-05-27 00:24:42.
diff -ru tcllib-1.13/modules/struct/list.tcl tcllib-changed/modules/struct/list.tcl
--- tcllib-1.13/modules/struct/list.tcl 2011-01-25 06:37:58.000000000 +0100
+++ tcllib-changed/modules/struct/list.tcl      2011-05-24 17:15:38.000000000 +0200
@@ -942,7 +942,7 @@
     # Author of this command is "Richard Suchenwirth"

     if {[::llength $a] != [::llength $b]} {return 0}
-    if {[::lindex $a 0] == $a} {return [string equal $a $b]}
+    if {[::lindex $a 0] == $a && [::lindex $b 0] == $b} {return [string equal $a $b]}
     foreach i $a j $b {if {![Lequal $i $j]} {return 0}}
     return 1
 }
diff -ru tcllib-1.13/modules/struct/list.test tcllib-changed/modules/struct/list.test
--- tcllib-1.13/modules/struct/list.test        2011-01-25 06:37:58.000000000 +0100
+++ tcllib-changed/modules/struct/list.test     2011-05-24 19:40:00.000000000 +0200
@@ -717,6 +720,32 @@
     equal {{0 2 3} 1} {{0 2 3} 1}
 } 1

+test equal-4.5 {equal command} {
+    equal [list [list a]] {{a}}
+} 1
+
+test equal-4.6 {equal command} {
+    equal {{a}} [list [list a]]
+} 1
+
+test equal-4.7 {equal command} {
+    set a {{a}}
+    set b [list [list a]]
+    expr {[equal $a $b] == [equal $b $a]}
+} 1
+
+test equal-4.8 {equal command} {
+    set a {{a b}}
+    set b [list [list a b]]
+    expr {[equal $a $b] == [equal $b $a]}
+} 1
+
+test equal-4.9 {equal command} {
+    set a {{a} {b}}
+    set b [list [list a] [list b]]
+    expr {[equal $a $b] == [equal $b $a]}
+} 1
+
 #----------------------------------------------------------------------

 interp alias {} delete {} ::struct::list::list delete