Tk Source Code

Artifact [c34e1fac]
Login

Artifact c34e1fac44fc88e531a9dae039deb90af66a187c5d1eb9b3f7378ea6b9992bab:

Attachment "treetags.test.diff" to ticket [1bb2f1d7] added by emiliano 2020-05-04 21:38:04. (unpublished)
Index: tests/ttk/treetags.test
==================================================================
--- tests/ttk/treetags.test
+++ tests/ttk/treetags.test
@@ -9,16 +9,15 @@
 proc assert {expr {message ""}} {
     if {![uplevel 1 [list expr $expr]]} {
         error "PANIC: $message ($expr failed)"
     }
 }
-proc in {e l} { expr {[lsearch -exact $l $e] >= 0} }
 
 proc itemConstraints {tv item} {
     # $tag in [$tv item $item -tags] <==> [$tv tag has $tag $item]
     foreach tag [$tv item $item -tags] {
-	assert {[in $item [$tv tag has $tag]]}
+	assert {$item in [$tv tag has $tag]}
     }
     foreach child [$tv children $item] {
 	itemConstraints $tv $child
     }
 }
@@ -26,11 +25,11 @@
 proc treeConstraints {tv} {
     # $item in [$tv tag has $tag] <==> [$tv tag has $tag $item]
     #
     foreach tag [$tv tag names] {
 	foreach item [$tv tag has $tag] {
-	    assert {[in $tag [$tv item $item -tags]]}
+	    assert {$tag in [$tv item $item -tags]}
 	}
     }
 
     itemConstraints $tv {}
 }
@@ -111,10 +110,17 @@
 
 test treetags-1.10 "tag names - tag configured" -body {
     $tv tag configure tag5
     lsort [$tv tag names]
 } -result [list tag1 tag2 tag3 tag4 tag5]
+
+test treetags-1.11 "tag delete" -body {
+    $tv tag delete tag5
+    $tv tag delete tag4
+    lsort [$tv tag names]
+} -result [list tag1 tag2 tag3]
+
 
 test treetags-1.end "cleanup" -body {
     $tv item item1 -tags tag1
     $tv item item2 -tags tag2
     list [$tv tag has tag1] [$tv tag has tag2] [$tv tag has tag3]