#
# Trying to create a test script for the tree package's failure.
# This happens with Tcl 8.4.13 using the 'criticl' version of struct::tree
# (under Win98, but I doubt that this matters).
#
# It does NOT happen with 8.4.91 and (with 8.4.13) it does NOT happen with
# the pure Tcl version of struct::tree.
#

package require struct::tree

# Write $s to $fName
proc strToFile {fName s} {
    set fd [open $fName w]
    puts -nonewline $fd $s
    close $fd
}

set tree1 [::struct::tree]
# create a node
set node [$tree1 insert root end]
# save and delete the tree
set content1 [$tree1 serialize]
strToFile tree1.txt $content1
$tree1 destroy

# use the content of tree1 to create another tree
set tree2 [::struct::tree]
$tree2 deserialize $content1
# create another node --- tree2's root will now have 2 children
set node [$tree2 insert root end]
# save and delete the tree
strToFile tree2.txt [$tree2 serialize]
$tree2 destroy      ;# BOOM

# If you look at file tree2.txt you will notice that root does have 2 children
# now BUT BOTH are named 'node1'.