2 # Tests for using [incr Tcl] in child interpreters
3 # ----------------------------------------------------------------------
4 # AUTHOR: Michael J. McLennan
5 # Bell Labs Innovations for Lucent Technologies
7 # http://www.tcltk.com/itcl
8 # ----------------------------------------------------------------------
9 # Copyright (c) 1993-1998 Lucent Technologies, Inc.
10 # ======================================================================
11 # See the file "license.terms" for information on usage and
12 # redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
14 package require tcltest 2.1
15 namespace import ::tcltest::test
16 ::tcltest::loadTestedCommands
19 # ----------------------------------------------------------------------
20 # Make sure that child interpreters can be created and loaded
22 # ----------------------------------------------------------------------
23 test interp-1.1 {create a child interp with [incr Tcl]} {
26 list [child eval "namespace children :: itcl"] [interp delete child]
29 test interp-1.2 {create a safe child interp with [incr Tcl]} {
30 interp create -safe child
32 list [child eval "namespace children :: itcl"] [interp delete child]
35 test interp-1.3 {errors are okay when child interp is deleted} {
36 catch {interp delete child}
40 itcl::class Troublemaker {
41 destructor { error "cannot delete this object" }
46 set obj [Troublemaker #auto]
57 test interp-1.4 {one namespace can cause another to be destroyed} {
61 namespace eval group {
65 itcl::class TroubleMaker {
66 inherit group::base1 group::base2
72 test interp-1.5 {cleanup interp object list, this should not
73 include an object that deletes itself in ctor} {
77 itcl::class DeleteSelf {
79 itcl::delete object $this
87 ::tcltest::cleanupTests