#
# 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
# ----------------------------------------------------------------------
#            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::*

::tcltest::loadTestedCommands


# ----------------------------------------------------------------------
#  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 load [incr Tk] into a safe interp} {
    safe::interpCreate slave
    safe::loadTk slave
    load "" Itcl slave
    set result [list [catch {load "" Itk slave} msg] $msg]
    safe::interpDelete slave
    set result
} {0 {}}

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
