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