summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tests/safe.test766
1 files changed, 599 insertions, 167 deletions
diff --git a/tests/safe.test b/tests/safe.test
index 19daabc..e0a2d84 100644
--- a/tests/safe.test
+++ b/tests/safe.test
@@ -37,6 +37,11 @@ set ::auto_path [info library]
set TestsDir [file normalize [file dirname [info script]]]
set PathMapp [list $tcl_library TCLLIB $TestsDir TESTSDIR]
+proc getAutoPath {slave} {
+ set ap1 [lrange [lindex [safe::interpConfigure $slave -autoPath] 1] 0 end]
+ set ap2 [::safe::DetokPath $slave [interp eval $slave set ::auto_path]]
+ list $ap1 -- $ap2
+}
proc mapList {map listIn} {
set listOut {}
foreach element $listIn {
@@ -1731,6 +1736,120 @@ test safe-14.1 {Check that module path is the same as in the master interpreter
} -cleanup {
safe::interpDelete $i
} -result [::tcl::tm::path list]
+test safe-14.2 {Check that first element of slave auto_path (and access path) is Tcl Library, Sync Mode on} -setup {
+ set SyncExists [expr {[info commands ::safe::setAutoPathSync] ne {}}]
+ if {$SyncExists} {
+ set SyncVal_TMP [safe::setAutoPathSync]
+ safe::setAutoPathSync 1
+ }
+
+ set lib1 [info library]
+ set lib2 [file dirname $lib1]
+ set ::auto_TMP $::auto_path
+ set ::auto_path [list $lib1 $lib2]
+
+ set i [safe::interpCreate]
+} -body {
+ set autoList {}
+ set token [lindex [$i eval set ::auto_path] 0]
+ set auto0 [dict get [set ::safe::S${i}(access_path,map)] $token]
+ set accessList [lindex [safe::interpConfigure $i -accessPath] 1]
+ return [list [lindex $accessList 0] $auto0]
+} -cleanup {
+ set ::auto_path $::auto_TMP
+ safe::interpDelete $i
+ if {$SyncExists} {
+ safe::setAutoPathSync $SyncVal_TMP
+ }
+} -result [list [info library] [info library]]
+test safe-14.2.1 {Check that first element of slave auto_path (and access path) is Tcl Library, Sync Mode off} -constraints AutoSyncDefined -setup {
+ set SyncExists [expr {[info commands ::safe::setAutoPathSync] ne {}}]
+ if {$SyncExists} {
+ set SyncVal_TMP [safe::setAutoPathSync]
+ safe::setAutoPathSync 0
+ } else {
+ error {This test is meaningful only if the command ::safe::setAutoPathSync is defined}
+ }
+
+ set lib1 [info library]
+ set lib2 [file dirname $lib1]
+ set ::auto_TMP $::auto_path
+ set ::auto_path [list $lib1 $lib2]
+
+ set i [safe::interpCreate]
+} -body {
+ set autoList {}
+ set token [lindex [$i eval set ::auto_path] 0]
+ set auto0 [dict get [set ::safe::S${i}(access_path,map)] $token]
+ set accessList [lindex [safe::interpConfigure $i -accessPath] 1]
+ set autoList [lindex [safe::interpConfigure $i -autoPath] 1]
+ return [list [lindex $accessList 0] [lindex $autoList 0] $auto0]
+} -cleanup {
+ set ::auto_path $::auto_TMP
+ safe::interpDelete $i
+ if {$SyncExists} {
+ safe::setAutoPathSync $SyncVal_TMP
+ }
+} -result [list [info library] [info library] [info library]]
+test safe-14.3 {Check that first element of slave auto_path (and access path) is Tcl Library, even if not true for master, Sync Mode on} -setup {
+ set SyncExists [expr {[info commands ::safe::setAutoPathSync] ne {}}]
+ if {$SyncExists} {
+ set SyncVal_TMP [safe::setAutoPathSync]
+ safe::setAutoPathSync 1
+ }
+
+ set lib1 [info library]
+ set lib2 [file dirname $lib1]
+ set ::auto_TMP $::auto_path
+ set ::auto_path [list $lib2 $lib1]
+ # Unexpected order, should be reversed in the slave
+
+ set i [safe::interpCreate]
+} -body {
+ set autoList {}
+ set token [lindex [$i eval set ::auto_path] 0]
+ set auto0 [dict get [set ::safe::S${i}(access_path,map)] $token]
+ set accessList [lindex [safe::interpConfigure $i -accessPath] 1]
+
+ return [list [lindex $accessList 0] $auto0]
+} -cleanup {
+ set ::auto_path $::auto_TMP
+ safe::interpDelete $i
+ if {$SyncExists} {
+ safe::setAutoPathSync $SyncVal_TMP
+ }
+} -result [list [info library] [info library]]
+test safe-14.3.1 {Check that first element of slave auto_path (and access path) is Tcl Library, even if not true for master, Sync Mode off} -constraints AutoSyncDefined -setup {
+ set SyncExists [expr {[info commands ::safe::setAutoPathSync] ne {}}]
+ if {$SyncExists} {
+ set SyncVal_TMP [safe::setAutoPathSync]
+ safe::setAutoPathSync 0
+ } else {
+ error {This test is meaningful only if the command ::safe::setAutoPathSync is defined}
+ }
+
+ set lib1 [info library]
+ set lib2 [file dirname $lib1]
+ set ::auto_TMP $::auto_path
+ set ::auto_path [list $lib2 $lib1]
+ # Unexpected order, should be reversed in the slave
+
+ set i [safe::interpCreate]
+} -body {
+ set autoList {}
+ set token [lindex [$i eval set ::auto_path] 0]
+ set auto0 [dict get [set ::safe::S${i}(access_path,map)] $token]
+ set accessList [lindex [safe::interpConfigure $i -accessPath] 1]
+ set autoList [lindex [safe::interpConfigure $i -autoPath] 1]
+
+ return [list [lindex $accessList 0] [lindex $autoList 0] $auto0]
+} -cleanup {
+ set ::auto_path $::auto_TMP
+ safe::interpDelete $i
+ if {$SyncExists} {
+ safe::setAutoPathSync $SyncVal_TMP
+ }
+} -result [list [info library] [info library] [info library]]
### 15. Safe file ensemble.
@@ -1869,123 +1988,6 @@ test safe-16.8 {Bug 3529949: defang ~user in paths used by AliasGlob (2)} -setup
unset user
} -result {~USER}
-### 14.x move above.
-
-test safe-14.2 {Check that first element of slave auto_path (and access path) is Tcl Library, Sync Mode on} -setup {
- set SyncExists [expr {[info commands ::safe::setAutoPathSync] ne {}}]
- if {$SyncExists} {
- set SyncVal_TMP [safe::setAutoPathSync]
- safe::setAutoPathSync 1
- }
-
- set lib1 [info library]
- set lib2 [file dirname $lib1]
- set ::auto_TMP $::auto_path
- set ::auto_path [list $lib1 $lib2]
-
- set i [safe::interpCreate]
-} -body {
- set autoList {}
- set token [lindex [$i eval set ::auto_path] 0]
- set auto0 [dict get [set ::safe::S${i}(access_path,map)] $token]
- set accessList [lindex [safe::interpConfigure $i -accessPath] 1]
- return [list [lindex $accessList 0] $auto0]
-} -cleanup {
- set ::auto_path $::auto_TMP
- safe::interpDelete $i
- if {$SyncExists} {
- safe::setAutoPathSync $SyncVal_TMP
- }
-} -result [list [info library] [info library]]
-test safe-14.2.1 {Check that first element of slave auto_path (and access path) is Tcl Library, Sync Mode off} -constraints AutoSyncDefined -setup {
- set SyncExists [expr {[info commands ::safe::setAutoPathSync] ne {}}]
- if {$SyncExists} {
- set SyncVal_TMP [safe::setAutoPathSync]
- safe::setAutoPathSync 0
- } else {
- error {This test is meaningful only if the command ::safe::setAutoPathSync is defined}
- }
-
- set lib1 [info library]
- set lib2 [file dirname $lib1]
- set ::auto_TMP $::auto_path
- set ::auto_path [list $lib1 $lib2]
-
- set i [safe::interpCreate]
-} -body {
- set autoList {}
- set token [lindex [$i eval set ::auto_path] 0]
- set auto0 [dict get [set ::safe::S${i}(access_path,map)] $token]
- set accessList [lindex [safe::interpConfigure $i -accessPath] 1]
- set autoList [lindex [safe::interpConfigure $i -autoPath] 1]
- return [list [lindex $accessList 0] [lindex $autoList 0] $auto0]
-} -cleanup {
- set ::auto_path $::auto_TMP
- safe::interpDelete $i
- if {$SyncExists} {
- safe::setAutoPathSync $SyncVal_TMP
- }
-} -result [list [info library] [info library] [info library]]
-test safe-14.3 {Check that first element of slave auto_path (and access path) is Tcl Library, even if not true for master, Sync Mode on} -setup {
- set SyncExists [expr {[info commands ::safe::setAutoPathSync] ne {}}]
- if {$SyncExists} {
- set SyncVal_TMP [safe::setAutoPathSync]
- safe::setAutoPathSync 1
- }
-
- set lib1 [info library]
- set lib2 [file dirname $lib1]
- set ::auto_TMP $::auto_path
- set ::auto_path [list $lib2 $lib1]
- # Unexpected order, should be reversed in the slave
-
- set i [safe::interpCreate]
-} -body {
- set autoList {}
- set token [lindex [$i eval set ::auto_path] 0]
- set auto0 [dict get [set ::safe::S${i}(access_path,map)] $token]
- set accessList [lindex [safe::interpConfigure $i -accessPath] 1]
-
- return [list [lindex $accessList 0] $auto0]
-} -cleanup {
- set ::auto_path $::auto_TMP
- safe::interpDelete $i
- if {$SyncExists} {
- safe::setAutoPathSync $SyncVal_TMP
- }
-} -result [list [info library] [info library]]
-test safe-14.3.1 {Check that first element of slave auto_path (and access path) is Tcl Library, even if not true for master, Sync Mode off} -constraints AutoSyncDefined -setup {
- set SyncExists [expr {[info commands ::safe::setAutoPathSync] ne {}}]
- if {$SyncExists} {
- set SyncVal_TMP [safe::setAutoPathSync]
- safe::setAutoPathSync 0
- } else {
- error {This test is meaningful only if the command ::safe::setAutoPathSync is defined}
- }
-
- set lib1 [info library]
- set lib2 [file dirname $lib1]
- set ::auto_TMP $::auto_path
- set ::auto_path [list $lib2 $lib1]
- # Unexpected order, should be reversed in the slave
-
- set i [safe::interpCreate]
-} -body {
- set autoList {}
- set token [lindex [$i eval set ::auto_path] 0]
- set auto0 [dict get [set ::safe::S${i}(access_path,map)] $token]
- set accessList [lindex [safe::interpConfigure $i -accessPath] 1]
- set autoList [lindex [safe::interpConfigure $i -autoPath] 1]
-
- return [list [lindex $accessList 0] [lindex $autoList 0] $auto0]
-} -cleanup {
- set ::auto_path $::auto_TMP
- safe::interpDelete $i
- if {$SyncExists} {
- safe::setAutoPathSync $SyncVal_TMP
- }
-} -result [list [info library] [info library] [info library]]
-
### 17. Test the use of ::auto_path for loading commands (via tclIndex files)
### and non-module packages (via pkgIndex.tcl files).
### Corresponding tests with Sync Mode on are 7.*
@@ -2152,6 +2154,109 @@ test safe-17.5 {cf. safe-7.5 - positive and negative module package require, inc
}
} -result {1 {can't find package test1} 0}
+### 18. Test tokenization of directories available to a slave.
+
+test safe-18.1 {Check that each directory of the default auto_path is a valid token, Sync Mode on} -setup {
+ set SyncExists [expr {[info commands ::safe::setAutoPathSync] ne {}}]
+ if {$SyncExists} {
+ set SyncVal_TMP [safe::setAutoPathSync]
+ safe::setAutoPathSync 1
+ }
+ set i [safe::interpCreate]
+} -body {
+ set badTokens {}
+ foreach dir [$i eval {set ::auto_path}] {
+ if {[regexp {^\$p\(:[0-9]+:\)$} $dir]} {
+ # Match - OK - token has expected form
+ } else {
+ # No match - possibly an ordinary path has not been tokenized
+ lappend badTokens $dir
+ }
+ }
+ set badTokens
+} -cleanup {
+ safe::interpDelete $i
+ if {$SyncExists} {
+ safe::setAutoPathSync $SyncVal_TMP
+ }
+} -result {}
+test safe-18.1.1 {Check that each directory of the default auto_path is a valid token, Sync Mode off} -constraints AutoSyncDefined -setup {
+ set SyncExists [expr {[info commands ::safe::setAutoPathSync] ne {}}]
+ if {$SyncExists} {
+ set SyncVal_TMP [safe::setAutoPathSync]
+ safe::setAutoPathSync 0
+ } else {
+ error {This test is meaningful only if the command ::safe::setAutoPathSync is defined}
+ }
+ set i [safe::interpCreate]
+} -body {
+ set badTokens {}
+ foreach dir [$i eval {set ::auto_path}] {
+ if {[regexp {^\$p\(:[0-9]+:\)$} $dir]} {
+ # Match - OK - token has expected form
+ } else {
+ # No match - possibly an ordinary path has not been tokenized
+ lappend badTokens $dir
+ }
+ }
+ set badTokens
+} -cleanup {
+ safe::interpDelete $i
+ if {$SyncExists} {
+ safe::setAutoPathSync $SyncVal_TMP
+ }
+} -result {}
+test safe-18.2 {Check that each directory of the module path is a valid token, Sync Mode on} -setup {
+ set SyncExists [expr {[info commands ::safe::setAutoPathSync] ne {}}]
+ if {$SyncExists} {
+ set SyncVal_TMP [safe::setAutoPathSync]
+ safe::setAutoPathSync 1
+ }
+ set i [safe::interpCreate]
+} -body {
+ set badTokens {}
+ foreach dir [$i eval {::tcl::tm::path list}] {
+ if {[regexp {^\$p\(:[0-9]+:\)$} $dir]} {
+ # Match - OK - token has expected form
+ } else {
+ # No match - possibly an ordinary path has not been tokenized
+ lappend badTokens $dir
+ }
+ }
+ set badTokens
+} -cleanup {
+ safe::interpDelete $i
+ if {$SyncExists} {
+ safe::setAutoPathSync $SyncVal_TMP
+ }
+} -result {}
+test safe-18.2.1 {Check that each directory of the module path is a valid token, Sync Mode off} -constraints AutoSyncDefined -setup {
+ set SyncExists [expr {[info commands ::safe::setAutoPathSync] ne {}}]
+ if {$SyncExists} {
+ set SyncVal_TMP [safe::setAutoPathSync]
+ safe::setAutoPathSync 0
+ } else {
+ error {This test is meaningful only if the command ::safe::setAutoPathSync is defined}
+ }
+ set i [safe::interpCreate]
+} -body {
+ set badTokens {}
+ foreach dir [$i eval {::tcl::tm::path list}] {
+ if {[regexp {^\$p\(:[0-9]+:\)$} $dir]} {
+ # Match - OK - token has expected form
+ } else {
+ # No match - possibly an ordinary path has not been tokenized
+ lappend badTokens $dir
+ }
+ }
+ set badTokens
+} -cleanup {
+ safe::interpDelete $i
+ if {$SyncExists} {
+ safe::setAutoPathSync $SyncVal_TMP
+ }
+} -result {}
+
### 19. Assorted options, including changes to option values.
### Mostly these are changes to access path, auto_path, module path.
### If Sync Mode is on, a corresponding test with Sync Mode off is 9.*
@@ -3019,33 +3124,63 @@ test safe-19.24 {interpConfigure change the access path; check module loading, S
res0 res1 res2}
# See comments on lsort after test safe-9.20.
-### 18. Test tokenization of directories available to a slave.
-test safe-18.1 {Check that each directory of the default auto_path is a valid token, Sync Mode on} -setup {
+### 20. safe::interpCreate with different cases of -accessPath, -autoPath.
+
+set ::auto_path [list $tcl_library [file dirname $tcl_library] [file join $TestsDir auto0]]
+
+test safe-20.1 "create -accessPath NULL -autoPath NULL -> master's ::auto_path" -constraints AutoSyncDefined -setup {
set SyncExists [expr {[info commands ::safe::setAutoPathSync] ne {}}]
if {$SyncExists} {
set SyncVal_TMP [safe::setAutoPathSync]
- safe::setAutoPathSync 1
+ safe::setAutoPathSync 0
+ } else {
+ error {This test is meaningful only if the command ::safe::setAutoPathSync is defined}
}
+} -body {
set i [safe::interpCreate]
+ getAutoPath $i
+} -cleanup {
+ safe::interpDelete $i
+ if {$SyncExists} {
+ safe::setAutoPathSync $SyncVal_TMP
+ }
+} -result [list $::auto_path -- $::auto_path]
+test safe-20.2 "create -accessPath {} -autoPath NULL -> master's ::auto_path" -constraints AutoSyncDefined -setup {
+ set SyncExists [expr {[info commands ::safe::setAutoPathSync] ne {}}]
+ if {$SyncExists} {
+ set SyncVal_TMP [safe::setAutoPathSync]
+ safe::setAutoPathSync 0
+ } else {
+ error {This test is meaningful only if the command ::safe::setAutoPathSync is defined}
+ }
} -body {
- set badTokens {}
- foreach dir [$i eval {set ::auto_path}] {
- if {[regexp {^\$p\(:[0-9]+:\)$} $dir]} {
- # Match - OK - token has expected form
- } else {
- # No match - possibly an ordinary path has not been tokenized
- lappend badTokens $dir
- }
+ set i [safe::interpCreate -accessPath {}]
+ getAutoPath $i
+} -cleanup {
+ safe::interpDelete $i
+ if {$SyncExists} {
+ safe::setAutoPathSync $SyncVal_TMP
}
- set badTokens
+} -result [list $::auto_path -- $::auto_path]
+test safe-20.3 "create -accessPath path1 -autoPath NULL -> {}" -constraints AutoSyncDefined -setup {
+ set SyncExists [expr {[info commands ::safe::setAutoPathSync] ne {}}]
+ if {$SyncExists} {
+ set SyncVal_TMP [safe::setAutoPathSync]
+ safe::setAutoPathSync 0
+ } else {
+ error {This test is meaningful only if the command ::safe::setAutoPathSync is defined}
+ }
+} -body {
+ set i [safe::interpCreate -accessPath [lrange $::auto_path 0 1]]
+ getAutoPath $i
} -cleanup {
safe::interpDelete $i
if {$SyncExists} {
safe::setAutoPathSync $SyncVal_TMP
}
-} -result {}
-test safe-18.1.1 {Check that each directory of the default auto_path is a valid token, Sync Mode off} -constraints AutoSyncDefined -setup {
+} -result {{} -- {}}
+test safe-20.4 "create -accessPath NULL -autoPath {} -> {}" -constraints AutoSyncDefined -setup {
set SyncExists [expr {[info commands ::safe::setAutoPathSync] ne {}}]
if {$SyncExists} {
set SyncVal_TMP [safe::setAutoPathSync]
@@ -3053,49 +3188,67 @@ test safe-18.1.1 {Check that each directory of the default auto_path is a valid
} else {
error {This test is meaningful only if the command ::safe::setAutoPathSync is defined}
}
- set i [safe::interpCreate]
} -body {
- set badTokens {}
- foreach dir [$i eval {set ::auto_path}] {
- if {[regexp {^\$p\(:[0-9]+:\)$} $dir]} {
- # Match - OK - token has expected form
- } else {
- # No match - possibly an ordinary path has not been tokenized
- lappend badTokens $dir
- }
+ set i [safe::interpCreate -autoPath {}]
+ getAutoPath $i
+} -cleanup {
+ safe::interpDelete $i
+ if {$SyncExists} {
+ safe::setAutoPathSync $SyncVal_TMP
}
- set badTokens
+} -result {{} -- {}}
+test safe-20.5 "create -accessPath {} -autoPath {} -> {}" -constraints AutoSyncDefined -setup {
+ set SyncExists [expr {[info commands ::safe::setAutoPathSync] ne {}}]
+ if {$SyncExists} {
+ set SyncVal_TMP [safe::setAutoPathSync]
+ safe::setAutoPathSync 0
+ } else {
+ error {This test is meaningful only if the command ::safe::setAutoPathSync is defined}
+ }
+} -body {
+ set i [safe::interpCreate -accessPath {} -autoPath {}]
+ getAutoPath $i
} -cleanup {
safe::interpDelete $i
if {$SyncExists} {
safe::setAutoPathSync $SyncVal_TMP
}
-} -result {}
-test safe-18.2 {Check that each directory of the module path is a valid token, Sync Mode on} -setup {
+} -result {{} -- {}}
+test safe-20.6 "create -accessPath path1 -autoPath {} -> {}" -constraints AutoSyncDefined -setup {
set SyncExists [expr {[info commands ::safe::setAutoPathSync] ne {}}]
if {$SyncExists} {
set SyncVal_TMP [safe::setAutoPathSync]
- safe::setAutoPathSync 1
+ safe::setAutoPathSync 0
+ } else {
+ error {This test is meaningful only if the command ::safe::setAutoPathSync is defined}
}
- set i [safe::interpCreate]
} -body {
- set badTokens {}
- foreach dir [$i eval {::tcl::tm::path list}] {
- if {[regexp {^\$p\(:[0-9]+:\)$} $dir]} {
- # Match - OK - token has expected form
- } else {
- # No match - possibly an ordinary path has not been tokenized
- lappend badTokens $dir
- }
+ set i [safe::interpCreate -accessPath [lrange $::auto_path 0 1] -autoPath {}]
+ getAutoPath $i
+} -cleanup {
+ safe::interpDelete $i
+ if {$SyncExists} {
+ safe::setAutoPathSync $SyncVal_TMP
}
- set badTokens
+} -result {{} -- {}}
+test safe-20.7 "create -accessPath NULL -autoPath path2 -> path2" -constraints AutoSyncDefined -setup {
+ set SyncExists [expr {[info commands ::safe::setAutoPathSync] ne {}}]
+ if {$SyncExists} {
+ set SyncVal_TMP [safe::setAutoPathSync]
+ safe::setAutoPathSync 0
+ } else {
+ error {This test is meaningful only if the command ::safe::setAutoPathSync is defined}
+ }
+} -body {
+ set i [safe::interpCreate -autoPath [lrange $::auto_path 0 0]]
+ getAutoPath $i
} -cleanup {
safe::interpDelete $i
if {$SyncExists} {
safe::setAutoPathSync $SyncVal_TMP
}
-} -result {}
-test safe-18.2.1 {Check that each directory of the module path is a valid token, Sync Mode off} -constraints AutoSyncDefined -setup {
+} -result [list [lrange $::auto_path 0 0] -- [lrange $::auto_path 0 0]]
+test safe-20.8 "create -accessPath {} -autoPath path2 -> path2" -constraints AutoSyncDefined -setup {
set SyncExists [expr {[info commands ::safe::setAutoPathSync] ne {}}]
if {$SyncExists} {
set SyncVal_TMP [safe::setAutoPathSync]
@@ -3103,28 +3256,307 @@ test safe-18.2.1 {Check that each directory of the module path is a valid token,
} else {
error {This test is meaningful only if the command ::safe::setAutoPathSync is defined}
}
- set i [safe::interpCreate]
} -body {
- set badTokens {}
- foreach dir [$i eval {::tcl::tm::path list}] {
- if {[regexp {^\$p\(:[0-9]+:\)$} $dir]} {
- # Match - OK - token has expected form
- } else {
- # No match - possibly an ordinary path has not been tokenized
- lappend badTokens $dir
- }
+ set i [safe::interpCreate -accessPath {} -autoPath [lrange $::auto_path 0 0]]
+ getAutoPath $i
+} -cleanup {
+ safe::interpDelete $i
+ if {$SyncExists} {
+ safe::setAutoPathSync $SyncVal_TMP
}
- set badTokens
+} -result [list [lrange $::auto_path 0 0] -- [lrange $::auto_path 0 0]]
+test safe-20.9 "create -accessPath path1 -autoPath path2 -> path2" -constraints AutoSyncDefined -setup {
+ set SyncExists [expr {[info commands ::safe::setAutoPathSync] ne {}}]
+ if {$SyncExists} {
+ set SyncVal_TMP [safe::setAutoPathSync]
+ safe::setAutoPathSync 0
+ } else {
+ error {This test is meaningful only if the command ::safe::setAutoPathSync is defined}
+ }
+} -body {
+ set i [safe::interpCreate -accessPath [lrange $::auto_path 0 1] -autoPath [lrange $::auto_path 0 0]]
+ getAutoPath $i
} -cleanup {
safe::interpDelete $i
if {$SyncExists} {
safe::setAutoPathSync $SyncVal_TMP
}
-} -result {}
+} -result [list [lrange $::auto_path 0 0] -- [lrange $::auto_path 0 0]]
+test safe-20.10 "create -accessPath NULL -autoPath pathX -> pathX" -constraints AutoSyncDefined -setup {
+ set SyncExists [expr {[info commands ::safe::setAutoPathSync] ne {}}]
+ if {$SyncExists} {
+ set SyncVal_TMP [safe::setAutoPathSync]
+ safe::setAutoPathSync 0
+ } else {
+ error {This test is meaningful only if the command ::safe::setAutoPathSync is defined}
+ }
+} -body {
+ set i [safe::interpCreate -autoPath /not/in/access/path]
+ getAutoPath $i
+} -cleanup {
+ safe::interpDelete $i
+ if {$SyncExists} {
+ safe::setAutoPathSync $SyncVal_TMP
+ }
+} -result {/not/in/access/path -- {}}
+test safe-20.11 "create -accessPath {} -autoPath pathX -> pathX" -constraints AutoSyncDefined -setup {
+ set SyncExists [expr {[info commands ::safe::setAutoPathSync] ne {}}]
+ if {$SyncExists} {
+ set SyncVal_TMP [safe::setAutoPathSync]
+ safe::setAutoPathSync 0
+ } else {
+ error {This test is meaningful only if the command ::safe::setAutoPathSync is defined}
+ }
+} -body {
+ set i [safe::interpCreate -accessPath {} -autoPath /not/in/access/path]
+ getAutoPath $i
+} -cleanup {
+ safe::interpDelete $i
+ if {$SyncExists} {
+ safe::setAutoPathSync $SyncVal_TMP
+ }
+} -result {/not/in/access/path -- {}}
+test safe-20.12 "create -accessPath path1 -autoPath pathX -> {pathX}" -constraints AutoSyncDefined -setup {
+ set SyncExists [expr {[info commands ::safe::setAutoPathSync] ne {}}]
+ if {$SyncExists} {
+ set SyncVal_TMP [safe::setAutoPathSync]
+ safe::setAutoPathSync 0
+ } else {
+ error {This test is meaningful only if the command ::safe::setAutoPathSync is defined}
+ }
+} -body {
+ set i [safe::interpCreate -accessPath [lrange $::auto_path 0 1] -autoPath /not/in/access/path]
+ getAutoPath $i
+} -cleanup {
+ safe::interpDelete $i
+ if {$SyncExists} {
+ safe::setAutoPathSync $SyncVal_TMP
+ }
+} -result {/not/in/access/path -- {}}
+
+### 21. safe::interpConfigure with different cases of -accessPath, -autoPath.
+
+test safe-21.1 "interpConfigure -accessPath NULL -autoPath NULL -> no change" -constraints AutoSyncDefined -setup {
+ set SyncExists [expr {[info commands ::safe::setAutoPathSync] ne {}}]
+ if {$SyncExists} {
+ set SyncVal_TMP [safe::setAutoPathSync]
+ safe::setAutoPathSync 0
+ } else {
+ error {This test is meaningful only if the command ::safe::setAutoPathSync is defined}
+ }
+ set i [safe::interpCreate -accessPath [lrange $::auto_path 0 1] -autoPath [lrange $::auto_path 0 0]]
+} -body {
+ safe::interpConfigure $i -deleteHook {}
+ getAutoPath $i
+} -cleanup {
+ safe::interpDelete $i
+ if {$SyncExists} {
+ safe::setAutoPathSync $SyncVal_TMP
+ }
+} -result [list [lrange $::auto_path 0 0] -- [lrange $::auto_path 0 0]]
+test safe-21.2 "interpConfigure -accessPath {} -autoPath NULL -> master's ::auto_path" -constraints AutoSyncDefined -setup {
+ set SyncExists [expr {[info commands ::safe::setAutoPathSync] ne {}}]
+ if {$SyncExists} {
+ set SyncVal_TMP [safe::setAutoPathSync]
+ safe::setAutoPathSync 0
+ } else {
+ error {This test is meaningful only if the command ::safe::setAutoPathSync is defined}
+ }
+ set i [safe::interpCreate -accessPath [lrange $::auto_path 0 1] -autoPath [lrange $::auto_path 0 0]]
+} -body {
+ safe::interpConfigure $i -accessPath {}
+ getAutoPath $i
+} -cleanup {
+ safe::interpDelete $i
+ if {$SyncExists} {
+ safe::setAutoPathSync $SyncVal_TMP
+ }
+} -result [list $::auto_path -- $::auto_path]
+test safe-21.3 "interpConfigure -accessPath path1 -autoPath NULL -> no change" -constraints AutoSyncDefined -setup {
+ set SyncExists [expr {[info commands ::safe::setAutoPathSync] ne {}}]
+ if {$SyncExists} {
+ set SyncVal_TMP [safe::setAutoPathSync]
+ safe::setAutoPathSync 0
+ } else {
+ error {This test is meaningful only if the command ::safe::setAutoPathSync is defined}
+ }
+ set i [safe::interpCreate -accessPath [lrange $::auto_path 0 1] -autoPath [lrange $::auto_path 0 0]]
+} -body {
+ safe::interpConfigure $i -accessPath [lrange $::auto_path 0 1]
+ getAutoPath $i
+} -cleanup {
+ safe::interpDelete $i
+ if {$SyncExists} {
+ safe::setAutoPathSync $SyncVal_TMP
+ }
+} -result [list [lrange $::auto_path 0 0] -- [lrange $::auto_path 0 0]]
+test safe-21.4 "interpConfigure -accessPath NULL -autoPath {} -> {}" -constraints AutoSyncDefined -setup {
+ set SyncExists [expr {[info commands ::safe::setAutoPathSync] ne {}}]
+ if {$SyncExists} {
+ set SyncVal_TMP [safe::setAutoPathSync]
+ safe::setAutoPathSync 0
+ } else {
+ error {This test is meaningful only if the command ::safe::setAutoPathSync is defined}
+ }
+ set i [safe::interpCreate -accessPath [lrange $::auto_path 0 1] -autoPath [lrange $::auto_path 0 0]]
+} -body {
+ safe::interpConfigure $i -autoPath {}
+ getAutoPath $i
+} -cleanup {
+ safe::interpDelete $i
+ if {$SyncExists} {
+ safe::setAutoPathSync $SyncVal_TMP
+ }
+} -result {{} -- {}}
+test safe-21.5 "interpConfigure -accessPath {} -autoPath {} -> {}" -constraints AutoSyncDefined -setup {
+ set SyncExists [expr {[info commands ::safe::setAutoPathSync] ne {}}]
+ if {$SyncExists} {
+ set SyncVal_TMP [safe::setAutoPathSync]
+ safe::setAutoPathSync 0
+ } else {
+ error {This test is meaningful only if the command ::safe::setAutoPathSync is defined}
+ }
+ set i [safe::interpCreate -accessPath [lrange $::auto_path 0 1] -autoPath [lrange $::auto_path 0 0]]
+} -body {
+ safe::interpConfigure $i -accessPath {} -autoPath {}
+ getAutoPath $i
+} -cleanup {
+ safe::interpDelete $i
+ if {$SyncExists} {
+ safe::setAutoPathSync $SyncVal_TMP
+ }
+} -result {{} -- {}}
+test safe-21.6 "interpConfigure -accessPath {path1} -autoPath {} -> {}" -constraints AutoSyncDefined -setup {
+ set SyncExists [expr {[info commands ::safe::setAutoPathSync] ne {}}]
+ if {$SyncExists} {
+ set SyncVal_TMP [safe::setAutoPathSync]
+ safe::setAutoPathSync 0
+ } else {
+ error {This test is meaningful only if the command ::safe::setAutoPathSync is defined}
+ }
+ set i [safe::interpCreate -accessPath [lrange $::auto_path 0 1] -autoPath [lrange $::auto_path 0 0]]
+} -body {
+ safe::interpConfigure $i -accessPath [lrange $::auto_path 1 1] -autoPath {}
+ getAutoPath $i
+} -cleanup {
+ safe::interpDelete $i
+ if {$SyncExists} {
+ safe::setAutoPathSync $SyncVal_TMP
+ }
+} -result {{} -- {}}
+test safe-21.7 "interpConfigure -accessPath NULL -autoPath path2 -> path2" -constraints AutoSyncDefined -setup {
+ set SyncExists [expr {[info commands ::safe::setAutoPathSync] ne {}}]
+ if {$SyncExists} {
+ set SyncVal_TMP [safe::setAutoPathSync]
+ safe::setAutoPathSync 0
+ } else {
+ error {This test is meaningful only if the command ::safe::setAutoPathSync is defined}
+ }
+ set i [safe::interpCreate -accessPath [lrange $::auto_path 0 1] -autoPath [lrange $::auto_path 0 0]]
+} -body {
+ safe::interpConfigure $i -autoPath [lrange $::auto_path 1 1]
+ getAutoPath $i
+} -cleanup {
+ safe::interpDelete $i
+ if {$SyncExists} {
+ safe::setAutoPathSync $SyncVal_TMP
+ }
+} -result [list [lrange $::auto_path 1 1] -- [lrange $::auto_path 1 1]]
+test safe-21.8 "interpConfigure -accessPath {} -autoPath path2 -> path2" -constraints AutoSyncDefined -setup {
+ set SyncExists [expr {[info commands ::safe::setAutoPathSync] ne {}}]
+ if {$SyncExists} {
+ set SyncVal_TMP [safe::setAutoPathSync]
+ safe::setAutoPathSync 0
+ } else {
+ error {This test is meaningful only if the command ::safe::setAutoPathSync is defined}
+ }
+ set i [safe::interpCreate -accessPath [lrange $::auto_path 0 1] -autoPath [lrange $::auto_path 0 0]]
+} -body {
+ safe::interpConfigure $i -accessPath {} -autoPath [lrange $::auto_path 1 1]
+ getAutoPath $i
+} -cleanup {
+ safe::interpDelete $i
+ if {$SyncExists} {
+ safe::setAutoPathSync $SyncVal_TMP
+ }
+} -result [list [lrange $::auto_path 1 1] -- [lrange $::auto_path 1 1]]
+test safe-21.9 "interpConfigure -accessPath path1 -autoPath path2 -> path2" -constraints AutoSyncDefined -setup {
+ set SyncExists [expr {[info commands ::safe::setAutoPathSync] ne {}}]
+ if {$SyncExists} {
+ set SyncVal_TMP [safe::setAutoPathSync]
+ safe::setAutoPathSync 0
+ } else {
+ error {This test is meaningful only if the command ::safe::setAutoPathSync is defined}
+ }
+ set i [safe::interpCreate -accessPath [lrange $::auto_path 0 1] -autoPath [lrange $::auto_path 0 0]]
+} -body {
+ safe::interpConfigure $i -accessPath [lrange $::auto_path 0 2] -autoPath [lrange $::auto_path 1 1]
+ getAutoPath $i
+} -cleanup {
+ safe::interpDelete $i
+ if {$SyncExists} {
+ safe::setAutoPathSync $SyncVal_TMP
+ }
+} -result [list [lrange $::auto_path 1 1] -- [lrange $::auto_path 1 1]]
+test safe-21.10 "interpConfigure -accessPath NULL -autoPath pathX -> pathX" -constraints AutoSyncDefined -setup {
+ set SyncExists [expr {[info commands ::safe::setAutoPathSync] ne {}}]
+ if {$SyncExists} {
+ set SyncVal_TMP [safe::setAutoPathSync]
+ safe::setAutoPathSync 0
+ } else {
+ error {This test is meaningful only if the command ::safe::setAutoPathSync is defined}
+ }
+ set i [safe::interpCreate -accessPath [lrange $::auto_path 0 1] -autoPath [lrange $::auto_path 0 0]]
+} -body {
+ safe::interpConfigure $i -autoPath /not/in/access/path
+ getAutoPath $i
+} -cleanup {
+ safe::interpDelete $i
+ if {$SyncExists} {
+ safe::setAutoPathSync $SyncVal_TMP
+ }
+} -result {/not/in/access/path -- {}}
+test safe-21.11 "interpConfigure -accessPath {} -autoPath pathX -> pathX" -constraints AutoSyncDefined -setup {
+ set SyncExists [expr {[info commands ::safe::setAutoPathSync] ne {}}]
+ if {$SyncExists} {
+ set SyncVal_TMP [safe::setAutoPathSync]
+ safe::setAutoPathSync 0
+ } else {
+ error {This test is meaningful only if the command ::safe::setAutoPathSync is defined}
+ }
+ set i [safe::interpCreate -accessPath [lrange $::auto_path 0 1] -autoPath [lrange $::auto_path 0 0]]
+} -body {
+ safe::interpConfigure $i -accessPath {} -autoPath /not/in/access/path
+ getAutoPath $i
+} -cleanup {
+ safe::interpDelete $i
+ if {$SyncExists} {
+ safe::setAutoPathSync $SyncVal_TMP
+ }
+} -result {/not/in/access/path -- {}}
+test safe-21.12 "interpConfigure -accessPath path1 -autoPath pathX -> pathX" -constraints AutoSyncDefined -setup {
+ set SyncExists [expr {[info commands ::safe::setAutoPathSync] ne {}}]
+ if {$SyncExists} {
+ set SyncVal_TMP [safe::setAutoPathSync]
+ safe::setAutoPathSync 0
+ } else {
+ error {This test is meaningful only if the command ::safe::setAutoPathSync is defined}
+ }
+ set i [safe::interpCreate -accessPath [lrange $::auto_path 0 1] -autoPath [lrange $::auto_path 0 0]]
+} -body {
+ safe::interpConfigure $i -accessPath [lrange $::auto_path 0 2] -autoPath /not/in/access/path
+ getAutoPath $i
+} -cleanup {
+ safe::interpDelete $i
+ if {$SyncExists} {
+ safe::setAutoPathSync $SyncVal_TMP
+ }
+} -result {/not/in/access/path -- {}}
# cleanup
set ::auto_path $SaveAutoPath
unset SaveAutoPath TestsDir PathMapp
+rename getAutoPath {}
rename mapList {}
rename mapAndSortList {}
::tcltest::cleanupTests