File: interp.test

package info (click to toggle)
itcl3 3.2.1-3
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 2,452 kB
  • ctags: 967
  • sloc: ansic: 13,746; sh: 1,394; tcl: 1,022; makefile: 206
file content (56 lines) | stat: -rw-r--r-- 1,917 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
49
50
51
52
53
54
55
56
#
# 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.2 2000/06/01 21:32:36 wart 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.

package require tcltest
namespace import -force ::tcltest::*

if {[string compare test [info procs test]] == 1} then {source defs}

package require Itk

# ----------------------------------------------------------------------
#  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
} {}

::tcltest::cleanupTests
exit