diff options
author | dkf <donal.k.fellows@manchester.ac.uk> | 2011-09-26 10:46:36 (GMT) |
---|---|---|
committer | dkf <donal.k.fellows@manchester.ac.uk> | 2011-09-26 10:46:36 (GMT) |
commit | 643c7a2aa4c7b5cb1412a098ecacd72dc5f09aac (patch) | |
tree | fefa07fe0a7c1d24f6f787f9521de1b302a1e4b3 /tests/safe.test | |
parent | e3352567a2a3af2547b61485e6b91c0efd03533b (diff) | |
download | tcl-643c7a2aa4c7b5cb1412a098ecacd72dc5f09aac.zip tcl-643c7a2aa4c7b5cb1412a098ecacd72dc5f09aac.tar.gz tcl-643c7a2aa4c7b5cb1412a098ecacd72dc5f09aac.tar.bz2 |
Make [file] itself be safe, to reduce breakage in existing code. [Bug 3211758]
Diffstat (limited to 'tests/safe.test')
-rw-r--r-- | tests/safe.test | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/safe.test b/tests/safe.test index 0f82a6a..4190976 100644 --- a/tests/safe.test +++ b/tests/safe.test @@ -541,6 +541,22 @@ test safe-12.7 {glob is restricted} -setup { } -cleanup { safe::interpDelete $i } -match glob -result * + +test safe-13.1 {safe file ensemble does not surprise code} -setup { + set i [interp create -safe] +} -body { + set result [expr {"file" in [interp hidden $i]}] + lappend result [interp eval $i {tcl::file::split a/b/c}] + lappend result [catch {interp eval $i {tcl::file::isdirectory .}}] + lappend result [interp invokehidden $i file split a/b/c] + lappend result [catch {interp eval $i {file split a/b/c}} msg] $msg + lappend result [catch {interp invokehidden $i file isdirectory .}] + interp expose $i file + lappend result [catch {interp eval $i {file split a/b/c}} msg] $msg + lappend result [catch {interp eval $i {file isdirectory .}} msg] $msg +} -cleanup { + interp delete $i +} -result {1 {a b c} 1 {a b c} 1 {invalid command name "file"} 1 0 {a b c} 1 {invalid command name "::tcl::file::isdirectory"}} set ::auto_path $saveAutoPath # cleanup |