| ︙ | | |
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
|
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
|
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
|
foreach token [$i eval ::tcl::tm::path list] {
lappend tm [dict get [set ::safe::S${i}(access_path,map)] $token]
}
return $tm
} -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]
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 {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]
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]]
### 15. Safe file ensemble.
test safe-15.1 {safe file ensemble does not surprise code} -setup {
set i [interp create -safe]
} -body {
set result [expr {"file" in [interp hidden $i]}]
|
| ︙ | | |
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
|
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
|
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
|
} -body {
string map [list $user USER] [$i eval [list file join {$p(:0:)/foo/bar} ~$user]]
} -cleanup {
safe::interpDelete $i
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]
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 {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]
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]]
### 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.*
test safe-17.1 {cf. safe-7.1 - positive non-module package require, Sync Mode off} -constraints AutoSyncDefined -setup {
set SyncExists [expr {[info commands ::safe::setAutoPathSync] ne {}}]
if {$SyncExists} {
|
| ︙ | | |
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
|
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
|
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
|
return [list $code1 $msg1 $code2]
} -cleanup {
safe::interpDelete $i
if {$SyncExists} {
safe::setAutoPathSync $SyncVal_TMP
}
} -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.*
test safe-19.8 {autoloading commands indexed in tclIndex files, Sync Mode off} -constraints AutoSyncDefined -setup {
set SyncExists [expr {[info commands ::safe::setAutoPathSync] ne {}}]
|
| ︙ | | |
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
|
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
|
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
|
0 0.5 0 1.0 0 2.0 --\
{TCLLIB TESTSDIR/auto0/modules TESTSDIR/auto0/modules/mod1\
TESTSDIR/auto0/modules/mod2} --\
{TCLLIB TESTSDIR/auto0/auto1 TESTSDIR/auto0/auto2 TESTSDIR/auto0/modules\
TESTSDIR/auto0/modules/mod1 TESTSDIR/auto0/modules/mod2} --\
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 {
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 {}
# cleanup
set ::auto_path $SaveAutoPath
unset SaveAutoPath TestsDir PathMapp
rename mapList {}
rename mapAndSortList {}
::tcltest::cleanupTests
return
# Local Variables:
# mode: tcl
# End:
|