summaryrefslogtreecommitdiffstats
path: root/tests/safe.test
diff options
context:
space:
mode:
authorhobbs <hobbs>2002-09-02 19:16:23 (GMT)
committerhobbs <hobbs>2002-09-02 19:16:23 (GMT)
commit0d02b5679eab39cae732f7ff18838de80de1affd (patch)
tree57a4ac634f6f7502add4d42adfdda01e1f07236f /tests/safe.test
parentc61554d78aab623bdfd1b7e78550578f2bb71866 (diff)
downloadtk-0d02b5679eab39cae732f7ff18838de80de1affd.zip
tk-0d02b5679eab39cae732f7ff18838de80de1affd.tar.gz
tk-0d02b5679eab39cae732f7ff18838de80de1affd.tar.bz2
* generic/tkCmds.c:
* generic/tkWindow.c: made 'tk' available in safe interpreters, but only the caret and windowingsystem subcommands may be called. * tests/safe.test (safe-1.2): noted that tk is now available in safe interps, but not the appname/scaling subcommands.
Diffstat (limited to 'tests/safe.test')
-rw-r--r--tests/safe.test30
1 files changed, 26 insertions, 4 deletions
diff --git a/tests/safe.test b/tests/safe.test
index ba483dc..060a1e1 100644
--- a/tests/safe.test
+++ b/tests/safe.test
@@ -6,7 +6,7 @@
# Copyright (c) 1998-1999 by Scriptics Corporation.
# All rights reserved.
#
-# RCS: @(#) $Id: safe.test,v 1.9 2002/07/13 20:28:35 dgp Exp $
+# RCS: @(#) $Id: safe.test,v 1.10 2002/09/02 19:16:24 hobbs Exp $
package require tcltest 2.1
namespace import -force tcltest::configure
@@ -38,11 +38,11 @@ tcltest::loadTestedCommands
# The set of hidden commands is platform dependent:
if {"$tcl_platform(platform)" == "macintosh"} {
- set hidden_cmds {beep bell cd clipboard echo encoding exit fconfigure file glob grab load ls menu open pwd selection send socket source tk tk_chooseColor tk_chooseDirectory tk_getOpenFile tk_getSaveFile toplevel wm}
+ set hidden_cmds {beep bell cd clipboard echo encoding exit fconfigure file glob grab load ls menu open pwd selection send socket source tk_chooseColor tk_chooseDirectory tk_getOpenFile tk_getSaveFile toplevel wm}
} elseif {"$tcl_platform(platform)" == "windows"} {
- set hidden_cmds {bell cd clipboard encoding exec exit fconfigure file glob grab load menu open pwd selection socket source tk tk_chooseColor tk_chooseDirectory tk_getOpenFile tk_getSaveFile tk_messageBox toplevel wm}
+ set hidden_cmds {bell cd clipboard encoding exec exit fconfigure file glob grab load menu open pwd selection socket source tk_chooseColor tk_chooseDirectory tk_getOpenFile tk_getSaveFile tk_messageBox toplevel wm}
} else {
- set hidden_cmds {bell cd clipboard encoding exec exit fconfigure file glob grab load menu open pwd selection send socket source tk toplevel wm}
+ set hidden_cmds {bell cd clipboard encoding exec exit fconfigure file glob grab load menu open pwd selection send socket source toplevel wm}
}
test safe-1.1 {Safe Tk loading into an interpreter} {
@@ -91,6 +91,28 @@ test safe-2.2 {Unsafe commands not available} {
safe::interpDelete a
set status
} ok
+test safe-2.3 {Unsafe subcommands not available} {
+ catch {safe::interpDelete a}
+ safe::interpCreate a
+ safe::loadTk a
+ set status broken
+ if {[catch {interp eval a {tk appname}} msg]} {
+ set status ok
+ }
+ safe::interpDelete a
+ list $status $msg
+} {ok {appname not accessible in a safe interpreter}}
+test safe-2.4 {Unsafe subcommands not available} {
+ catch {safe::interpDelete a}
+ safe::interpCreate a
+ safe::loadTk a
+ set status broken
+ if {[catch {interp eval a {tk scaling}} msg]} {
+ set status ok
+ }
+ safe::interpDelete a
+ list $status $msg
+} {ok {scaling not accessible in a safe interpreter}}
test safe-3.1 {Unsafe commands are available hidden} {
catch {safe::interpDelete a}