blob: e25c680bbd1b3695b6a2fe5955c7deeba5b1a431 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
#
# Tests for using [incr Tcl] in slave interpreters
# ----------------------------------------------------------------------
# AUTHOR: Michael J. McLennan
# Bell Labs Innovations for Lucent Technologies
# mmclennan@lucent.com
# http://www.tcltk.com/itcl
#
# RCS: $Id$
# ----------------------------------------------------------------------
# Copyright (c) 1993-1998 Lucent Technologies, Inc.
# ======================================================================
# See the file "license.terms" for information on usage and
# redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
if {[string compare test [info procs test]] == 1} then {source defs}
# ----------------------------------------------------------------------
# Make sure that slave interpreters can be created and loaded
# with [incr Tcl]...
# ----------------------------------------------------------------------
test interp-1.1 {create a slave interp with [incr Tcl]} {
interp create slave
load "" Itcl slave
list [slave eval "namespace children :: itcl"] [interp delete slave]
} {::itcl {}}
test interp-1.2 {create a safe slave interp with [incr Tcl]} {
interp create -safe slave
load "" Itcl slave
list [slave eval "namespace children :: itcl"] [interp delete slave]
} {::itcl {}}
test interp-1.3 {errors are okay when slave interp is deleted} {
interp create slave
load "" Itcl slave
slave eval {
itcl::class Troublemaker {
destructor { error "cannot delete this object" }
}
itcl::class Foo {
variable obj ""
constructor {} {
set obj [Troublemaker #auto]
}
destructor {
delete object $obj
}
}
Foo f
}
interp delete slave
} {}
test interp-1.4 {one namespace can cause another to be destroyed} {
interp create slave
load "" Itcl slave
slave eval {
namespace eval group {
itcl::class base1 {}
itcl::class base2 {}
}
itcl::class TroubleMaker {
inherit group::base1 group::base2
}
}
interp delete slave
} {}
|