File: interp.test

package info (click to toggle)
itcl3.1 3.1.0-6
  • links: PTS
  • area: main
  • in suites: woody
  • size: 9,604 kB
  • ctags: 1,045
  • sloc: tcl: 33,268; ansic: 14,071; sh: 3,918; makefile: 762; awk: 273; perl: 265
file content (48 lines) | stat: -rw-r--r-- 1,807 bytes parent folder | download | duplicates (5)
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
#
# 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: interp.test,v 1.1 1998/07/27 18:45:31 stanton Exp $
# ----------------------------------------------------------------------
#            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] / [incr Tk]...
# ----------------------------------------------------------------------
test interp-1.1 {create a slave interp with [incr Tk]} {
    interp create slave
    load "" Itcl slave
    load "" Tk slave
    load "" Itk slave
    list [slave eval "namespace children :: ::itk"] [interp delete slave]
} {::itk {}}

test interp-1.2 {can't load [incr Tk] into a safe interp} {
    interp create -safe slave
    load "" Itcl slave
    set result [list [catch {load "" Itk slave} msg] $msg]
    interp delete slave
    set result
} {1 {can't use package in a safe interpreter: no Itk_SafeInit procedure}}

test interp-1.3 {errors are okay when slave interp is deleted} {
    interp create slave
    load "" Itcl slave
    load "" Tk slave
    load "" Itk slave
    slave eval {
        label .l
        bind .l <Destroy> {error "dying!"}
    }
    interp delete slave
} {}