summaryrefslogtreecommitdiffstats
path: root/tests/unload.test
diff options
context:
space:
mode:
Diffstat (limited to 'tests/unload.test')
-rw-r--r--tests/unload.test64
1 files changed, 32 insertions, 32 deletions
diff --git a/tests/unload.test b/tests/unload.test
index 0b10492..24b5e8d 100644
--- a/tests/unload.test
+++ b/tests/unload.test
@@ -4,9 +4,9 @@
# built-in commands. Sourcing this file into Tcl runs the tests and
# generates output for errors. No output means no errors were found.
#
-# Copyright (c) 1995 Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 Scriptics Corporation.
-# Copyright (c) 2003-2004 Georgios Petasis
+# Copyright © 1995 Sun Microsystems, Inc.
+# Copyright © 1998-1999 Scriptics Corporation.
+# Copyright © 2003-2004 Georgios Petasis
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -17,7 +17,7 @@ if {"::tcltest" ni [namespace children]} {
}
::tcltest::loadTestedCommands
-catch [list package require -exact Tcltest [info patchlevel]]
+catch [list package require -exact tcl::test [info patchlevel]]
# Figure out what extension is used for shared libraries on this
# platform.
@@ -53,22 +53,22 @@ proc loadIfNotPresent {pkg args} {
# Basic tests: parameter testing...
test unload-1.1 {basic errors} -returnCodes error -body {
unload
-} -result {wrong # args: should be "unload ?-switch ...? fileName ?packageName? ?interp?"}
+} -result {wrong # args: should be "unload ?-switch ...? fileName ?prefix? ?interp?"}
test unload-1.2 {basic errors} -returnCodes error -body {
unload a b c d
-} -result {wrong # args: should be "unload ?-switch ...? fileName ?packageName? ?interp?"}
+} -result {wrong # args: should be "unload ?-switch ...? fileName ?prefix? ?interp?"}
test unload-1.3 {basic errors} -returnCodes error -body {
unload a b foobar
} -result {could not find interpreter "foobar"}
test unload-1.4 {basic errors} -returnCodes error -body {
unload {}
-} -result {must specify either file name or package name}
+} -result {must specify either file name or prefix}
test unload-1.5 {basic errors} -returnCodes error -body {
unload {} {}
-} -result {must specify either file name or package name}
+} -result {must specify either file name or prefix}
test unload-1.6 {basic errors} -returnCodes error -body {
unload {} Unknown
-} -result {package "Unknown" is loaded statically and cannot be unloaded}
+} -result {library with prefix "Unknown" is loaded statically and cannot be unloaded}
test unload-1.7 {-nocomplain switch} {
unload -nocomplain {} Unknown
} {}
@@ -77,22 +77,22 @@ set pkgua_loaded {}
set pkgua_detached {}
set pkgua_unloaded {}
# Tests for loading/unloading in trusted (non-safe) interpreters...
-test unload-2.1 {basic loading of non-unloadable package, with guess for package name} [list $dll $loaded] {
+test unload-2.1 {basic loading of non-unloadable package, with guess for prefix} [list $dll $loaded] {
loadIfNotPresent pkga
list [pkga_eq abc def] [lsort [info commands pkga_*]]
} {0 {pkga_eq pkga_quote}}
-test unload-2.2 {basic loading of unloadable package, with guess for package name} [list $dll $loaded] {
+test unload-2.2 {basic loading of unloadable package, with guess for prefix} [list $dll $loaded] {
list $pkgua_loaded $pkgua_detached $pkgua_unloaded \
[load [file join $testDir pkgua$ext]] \
[pkgua_eq abc def] [lsort [info commands pkgua_*]] \
$pkgua_loaded $pkgua_detached $pkgua_unloaded
} {{} {} {} {} 0 {pkgua_eq pkgua_quote} . {} {}}
-test unload-2.3 {basic unloading of non-unloadable package, with guess for package name} -setup {
+test unload-2.3 {basic unloading of non-unloadable package, with guess for prefix} -setup {
loadIfNotPresent pkga
} -constraints [list $dll $loaded] -returnCodes error -match glob -body {
unload [file join $testDir pkga$ext]
} -result {file "*" cannot be unloaded under a trusted interpreter}
-test unload-2.4 {basic unloading of unloadable package, with guess for package name} -setup {
+test unload-2.4 {basic unloading of unloadable package, with guess for prefix} -setup {
loadIfNotPresent pkgua
} -constraints [list $dll $loaded] -body {
list $pkgua_loaded $pkgua_detached $pkgua_unloaded \
@@ -100,7 +100,7 @@ test unload-2.4 {basic unloading of unloadable package, with guess for package n
[info commands pkgua_*] \
$pkgua_loaded $pkgua_detached $pkgua_unloaded
} -result {. {} {} {} {} . . .}
-test unload-2.5 {reloading of unloaded package, with guess for package name} -setup {
+test unload-2.5 {reloading of unloaded package, with guess for prefix} -setup {
if {$pkgua_loaded eq ""} {
loadIfNotPresent pkgua
unload [file join $testDir pkgua$ext]
@@ -111,7 +111,7 @@ test unload-2.5 {reloading of unloaded package, with guess for package name} -se
[pkgua_eq abc def] [lsort [info commands pkgua_*]] \
$pkgua_loaded $pkgua_detached $pkgua_unloaded
} -result {. . . {} 0 {pkgua_eq pkgua_quote} .. . .}
-test unload-2.6 {basic unloading of re-loaded package, with guess for package name} -setup {
+test unload-2.6 {basic unloading of re-loaded package, with guess for prefix} -setup {
# Establish expected state
if {$pkgua_loaded eq ""} {
loadIfNotPresent pkgua
@@ -132,17 +132,17 @@ child eval {
set pkgua_detached {}
set pkgua_unloaded {}
}
-test unload-3.1 {basic loading of non-unloadable package in a safe interpreter, with package name conversion} \
+test unload-3.1 {basic loading of non-unloadable package in a safe interpreter} \
[list $dll $loaded] {
catch {rename pkgb_sub {}}
load [file join $testDir pkgb$ext] Pkgb child
list [child eval pkgb_sub 44 13] [catch {child eval pkgb_unsafe} msg] $msg \
[catch {pkgb_sub 12 10} msg2] $msg2
} {31 1 {invalid command name "pkgb_unsafe"} 1 {invalid command name "pkgb_sub"}}
-test unload-3.2 {basic loading of unloadable package in a safe interpreter, with package name conversion} \
+test unload-3.2 {basic loading of unloadable package in a safe interpreter} \
[list $dll $loaded] {
list [child eval {list $pkgua_loaded $pkgua_detached $pkgua_unloaded}] \
- [load [file join $testDir pkgua$ext] Pkgua child] \
+ [load [file join $testDir pkgua$ext] pkgua child] \
[child eval pkgua_eq abc def] \
[lsort [child eval info commands pkgua_*]] \
[child eval {list $pkgua_loaded $pkgua_detached $pkgua_unloaded}]
@@ -152,14 +152,14 @@ test unload-3.3 {unloading of a package that has never been loaded from a safe i
} -constraints [list $dll $loaded] -returnCodes error -match glob -body {
unload [file join $testDir pkga$ext] {} child
} -result {file "*" has never been loaded in this interpreter}
-test unload-3.4 {basic unloading of a non-unloadable package from a safe interpreter, with guess for package name} -setup {
+test unload-3.4 {basic unloading of a non-unloadable package from a safe interpreter, with guess for prefix} -setup {
if {[lsearch -index 1 [info loaded child] Pkgb] < 0} {
load [file join $testDir pkgb$ext] Pkgb child
}
} -constraints [list $dll $loaded] -returnCodes error -match glob -body {
unload [file join $testDir pkgb$ext] {} child
} -result {file "*" cannot be unloaded under a safe interpreter}
-test unload-3.5 {basic unloading of an unloadable package from a safe interpreter, with guess for package name} -setup {
+test unload-3.5 {basic unloading of an unloadable package from a safe interpreter, with guess for prefix} -setup {
if {[lsearch -index 1 [info loaded child] Pkgua] < 0} {
load [file join $testDir pkgua$ext] Pkgua child
}
@@ -169,7 +169,7 @@ test unload-3.5 {basic unloading of an unloadable package from a safe interprete
[child eval info commands pkgua_*] \
[child eval {list $pkgua_loaded $pkgua_detached $pkgua_unloaded}]
} -result {{. {} {}} {} {} {. . .}}
-test unload-3.6 {reloading of unloaded package in a safe interpreter, with guess for package name} -setup {
+test unload-3.6 {reloading of unloaded package in a safe interpreter, with guess for prefix} -setup {
if {[child eval set pkgua_loaded] eq ""} {
load [file join $testDir pkgua$ext] {} child
unload [file join $testDir pkgua$ext] {} child
@@ -181,7 +181,7 @@ test unload-3.6 {reloading of unloaded package in a safe interpreter, with guess
[lsort [child eval info commands pkgua_*]] \
[child eval {list $pkgua_loaded $pkgua_detached $pkgua_unloaded}]
} -result {{. . .} {} 0 {pkgua_eq pkgua_quote} {.. . .}}
-test unload-3.7 {basic unloading of re-loaded package from a safe interpreter, with package name conversion} -setup {
+test unload-3.7 {basic unloading of re-loaded package from a safe interpreter, with prefix conversion} -setup {
if {[child eval set pkgua_loaded] eq ""} {
load [file join $testDir pkgua$ext] {} child
unload [file join $testDir pkgua$ext] {} child
@@ -189,7 +189,7 @@ test unload-3.7 {basic unloading of re-loaded package from a safe interpreter, w
}
} -constraints [list $dll $loaded] -body {
list [child eval {list $pkgua_loaded $pkgua_detached $pkgua_unloaded}] \
- [unload [file join $testDir pkgua$ext] Pkgua child] \
+ [unload [file join $testDir pkgua$ext] pKgUa child] \
[child eval info commands pkgua_*] \
[child eval {list $pkgua_loaded $pkgua_detached $pkgua_unloaded}]
} -result {{.. . .} {} {} {.. .. ..}}
@@ -203,7 +203,7 @@ child-trusted eval {
}
array set load {M 0 C 0 T 0}
## Load package in main trusted interpreter...
-test unload-4.1 {loading of unloadable package in trusted interpreter, with guess for package name} -setup {
+test unload-4.1 {loading of unloadable package in trusted interpreter, with guess for prefix} -setup {
set pkgua_loaded ""
set pkgua_detached ""
set pkgua_unloaded ""
@@ -215,7 +215,7 @@ test unload-4.1 {loading of unloadable package in trusted interpreter, with gues
[list $pkgua_loaded $pkgua_detached $pkgua_unloaded]
} -result {{{} {} {}} {} 0 {pkgua_eq pkgua_quote} {. {} {}}}
## Load package in child-safe interpreter...
-test unload-4.2 {basic loading of unloadable package in a safe interpreter, with package name conversion} -setup {
+test unload-4.2 {basic loading of unloadable package in a safe interpreter} -setup {
child eval {
set pkgua_loaded ""
set pkgua_detached ""
@@ -224,23 +224,23 @@ test unload-4.2 {basic loading of unloadable package in a safe interpreter, with
incr load(C)
} -constraints [list $dll $loaded] -body {
list [child eval {list $pkgua_loaded $pkgua_detached $pkgua_unloaded}] \
- [load [file join $testDir pkgua$ext] Pkgua child] \
+ [load [file join $testDir pkgua$ext] pkgua child] \
[child eval pkgua_eq abc def] \
[lsort [child eval info commands pkgua_*]] \
[child eval {list $pkgua_loaded $pkgua_detached $pkgua_unloaded}]
} -result {{{} {} {}} {} 0 {pkgua_eq pkgua_quote} {. {} {}}}
## Load package in child-trusted interpreter...
-test unload-4.3 {basic loading of unloadable package in a second trusted interpreter, with package name conversion} -setup {
+test unload-4.3 {basic loading of unloadable package in a second trusted interpreter} -setup {
incr load(T)
} -constraints [list $dll $loaded] -body {
list [child-trusted eval {list $pkgua_loaded $pkgua_detached $pkgua_unloaded}] \
- [load [file join $testDir pkgua$ext] Pkgua child-trusted] \
+ [load [file join $testDir pkgua$ext] pkgua child-trusted] \
[child-trusted eval pkgua_eq abc def] \
[lsort [child-trusted eval info commands pkgua_*]] \
[child-trusted eval {list $pkgua_loaded $pkgua_detached $pkgua_unloaded}]
} -result {{{} {} {}} {} 0 {pkgua_eq pkgua_quote} {. {} {}}}
## Unload the package from the main trusted interpreter...
-test unload-4.4 {basic unloading of unloadable package from trusted interpreter, with guess for package name} -setup {
+test unload-4.4 {basic unloading of unloadable package from trusted interpreter, with guess for prefix} -setup {
if {!$load(M)} {
load [file join $testDir pkgua$ext]
}
@@ -259,7 +259,7 @@ test unload-4.4 {basic unloading of unloadable package from trusted interpreter,
[list $pkgua_loaded $pkgua_detached $pkgua_unloaded]
} -result {{. {} {}} {} {} {. . {}}}
## Unload the package from the child safe interpreter...
-test unload-4.5 {basic unloading of unloadable package from a safe interpreter, with guess for package name} -setup {
+test unload-4.5 {basic unloading of unloadable package from a safe interpreter, with guess for prefix} -setup {
if {!$load(C)} {
load [file join $testDir pkgua$ext] {} child
}
@@ -274,7 +274,7 @@ test unload-4.5 {basic unloading of unloadable package from a safe interpreter,
[child eval {list $pkgua_loaded $pkgua_detached $pkgua_unloaded}]
} -result {{. {} {}} {} {} {. . {}}}
## Unload the package from the child trusted interpreter...
-test unload-4.6 {basic unloading of unloadable package from a safe interpreter, with guess for package name} -setup {
+test unload-4.6 {basic unloading of unloadable package from a safe interpreter, with guess for prefix} -setup {
if {!$load(T)} {
load [file join $testDir pkgua$ext] {} child-trusted
}
@@ -291,7 +291,7 @@ test unload-5.1 {unload a module loaded from vfs} \
set dir [pwd]
cd $testDir
testsimplefilesystem 1
- load simplefs:/pkgua$ext Pkgua
+ load simplefs:/pkgua$ext pkgua
} \
-body {
list [catch {unload simplefs:/pkgua$ext} msg] $msg