diff options
author | dkf <donal.k.fellows@manchester.ac.uk> | 2012-05-31 08:31:58 (GMT) |
---|---|---|
committer | dkf <donal.k.fellows@manchester.ac.uk> | 2012-05-31 08:31:58 (GMT) |
commit | c69794cc05d5ab01537ede052537fa25613c01c4 (patch) | |
tree | 2662cac0c4b4f7458c792fdfc1e8916f23f4d202 /tests | |
parent | 3186e522afae18a8fe8e1513d4a9e27500486613 (diff) | |
parent | 161a43e685132ef00e715c16fe1cf9c6a33e0a6d (diff) | |
download | tcl-c69794cc05d5ab01537ede052537fa25613c01c4.zip tcl-c69794cc05d5ab01537ede052537fa25613c01c4.tar.gz tcl-c69794cc05d5ab01537ede052537fa25613c01c4.tar.bz2 |
merge trunk
Diffstat (limited to 'tests')
-rw-r--r-- | tests/safe.test | 48 |
1 files changed, 47 insertions, 1 deletions
diff --git a/tests/safe.test b/tests/safe.test index 98d4543..f270248 100644 --- a/tests/safe.test +++ b/tests/safe.test @@ -27,7 +27,7 @@ set ::auto_path [info library] # Force actual loading of the safe package because we use un exported (and # thus un-autoindexed) APIs in this test result arguments: catch {safe::interpConfigure} - + # testing that nested and statics do what is advertised (we use a static # package - Tcltest - but it might be absent if we're in standard tclsh) @@ -698,6 +698,52 @@ test safe-15.1 {safe file ensemble does not surprise code} -setup { } -cleanup { interp delete $i } -result {1 {a b c} 1 {a b c} 1 {invalid command name "file"} 1 0 {a b c} 1 {not allowed to invoke subcommand isdirectory of file}} + +### ~ should have no special meaning in paths in safe interpreters +test safe-16.1 {Bug 3529949: defang ~ in paths} -setup { + set savedHOME $env(HOME) + set env(HOME) /foo/bar + set i [safe::interpCreate] +} -body { + $i eval { + set d [format %c 126] + list [file join [file dirname $d] [file tail $d]] + } +} -cleanup { + safe::interpDelete $i + set env(HOME) $savedHOME +} -result {./~} +test safe-16.2 {Bug 3529949: defang ~user in paths} -setup { + set i [safe::interpCreate] + set user $tcl_platform(user) +} -body { + string map [list $user USER] [$i eval \ + "file join \[file dirname ~$user\] \[file tail ~$user\]"] +} -cleanup { + safe::interpDelete $i +} -result {./~USER} +test safe-16.3 {Bug 3529949: defang ~ in globs} -setup { + set syntheticHOME [makeDirectory foo] + makeFile {} bar $syntheticHOME + set savedHOME $env(HOME) + set env(HOME) $syntheticHOME + set i [safe::interpCreate] +} -body { + ::safe::interpAddToAccessPath $i $syntheticHOME + $i eval {glob -nocomplain ~/*} +} -cleanup { + safe::interpDelete $i + set env(HOME) $savedHOME + removeDirectory $syntheticHOME +} -result {} +test safe-16.4 {Bug 3529949: defang ~user in globs} -setup { + set i [safe::interpCreate] +} -body { + ::safe::interpAddToAccessPath $i $~$tcl_platform(user) + $i eval [list glob -nocomplain ~$tcl_platform(user)/*] +} -cleanup { + safe::interpDelete $i +} -result {} set ::auto_path $saveAutoPath # cleanup |