Diff
Not logged in

Differences From Artifact [8c06f19389]:

To Artifact [d48da72bdc]:


1
2
3
4
5
6
7
8
9
10
11
12
13

14
15
16
17
18
19
20
1
2
3
4
5
6
7
8
9
10
11
12

13
14
15
16
17
18
19
20












-
+







# safe.test --
#
# This file contains a collection of tests for safe Tcl, packages loading,
# and using safe interpreters. Sourcing this file into tcl runs the tests
# and generates output for errors.  No output means no errors were found.
#
# Copyright (c) 1995-1996 Sun Microsystems, Inc.
# Copyright (c) 1998-1999 by Scriptics Corporation.
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
# RCS: @(#) $Id: safe.test,v 1.25 2008/10/14 17:17:46 dgp Exp $
# RCS: @(#) $Id: safe.test,v 1.26 2009/11/05 20:15:36 andreas_kupries Exp $

package require Tcl 8.5

if {[lsearch [namespace children] ::tcltest] == -1} {
    package require tcltest
    namespace import -force ::tcltest::*
}
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
113
114
115
116
117
118
119

















120
121
122
123
124
125
126







-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-







} ""
test safe-4.2 {safe::interpDelete, indirectly} {
    catch {safe::interpDelete a}
    interp create a
    a alias exit safe::interpDelete a
    a eval exit
} ""
test safe-4.3 {safe::interpDelete, state array (not a public api)} {
    catch {safe::interpDelete a}
    namespace eval safe {set [InterpStateName a](foo) 33}
    # not an error anymore to call it if interp is already
    # deleted, to make trhings smooth if it's called twice...
    catch {safe::interpDelete a} m1
    catch {namespace eval safe {set [InterpStateName a](foo)}} m2
    list $m1 $m2
} "{}\
   {can't read \"[safe::InterpStateName a](foo)\": no such variable}"
test safe-4.4 {safe::interpDelete, state array, indirectly (not a public api)} {
    catch {safe::interpDelete a}
    safe::interpCreate a
    namespace eval safe {set [InterpStateName a](foo) 33}
    a eval exit
    catch {namespace eval safe {set [InterpStateName a](foo)}} msg
} 1
test safe-4.5 {safe::interpDelete} {
    catch {safe::interpDelete a}
    safe::interpCreate a
    catch {safe::interpCreate a} msg
    set msg
} {interpreter named "a" already exists, cannot create}
test safe-4.6 {safe::interpDelete, indirectly} {