summaryrefslogtreecommitdiffstats
path: root/tests/unload.test
diff options
context:
space:
mode:
Diffstat (limited to 'tests/unload.test')
-rw-r--r--tests/unload.test65
1 files changed, 44 insertions, 21 deletions
diff --git a/tests/unload.test b/tests/unload.test
index 9e34bce..a103cc5 100644
--- a/tests/unload.test
+++ b/tests/unload.test
@@ -38,28 +38,32 @@ set alreadyTotalLoaded [info loaded]
# Certain tests require the 'teststaticpkg' command from tcltest
testConstraint teststaticpkg [llength [info commands teststaticpkg]]
+# Certain tests need the 'testsimplefilsystem' in tcltest
+testConstraint testsimplefilesystem \
+ [llength [info commands testsimplefilesystem]]
+
# Basic tests: parameter testing...
-test unload-1.1 {basic errors} {} {
- list [catch {unload} msg] $msg
-} "1 {wrong \# args: should be \"unload ?switches? fileName ?packageName? ?interp?\"}"
-test unload-1.2 {basic errors} {} {
- list [catch {unload a b c d} msg] $msg
-} "1 {wrong \# args: should be \"unload ?switches? fileName ?packageName? ?interp?\"}"
-test unload-1.3 {basic errors} {} {
- list [catch {unload a b foobar} msg] $msg
-} {1 {could not find interpreter "foobar"}}
-test unload-1.4 {basic errors} {} {
- list [catch {unload {}} msg] $msg
-} {1 {must specify either file name or package name}}
-test unload-1.5 {basic errors} {} {
- list [catch {unload {} {}} msg] $msg
-} {1 {must specify either file name or package name}}
-test unload-1.6 {basic errors} {} {
- list [catch {unload {} Unknown} msg] $msg
-} {1 {package "Unknown" is loaded statically and cannot be unloaded}}
-test unload-1.7 {-nocomplain switch} {} {
- list [unload -nocomplain {} Unknown]
-} {{}}
+test unload-1.1 {basic errors} -returnCodes error -body {
+ unload
+} -result {wrong # args: should be "unload ?-switch ...? fileName ?packageName? ?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?"}
+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}
+test unload-1.5 {basic errors} -returnCodes error -body {
+ unload {} {}
+} -result {must specify either file name or package name}
+test unload-1.6 {basic errors} -returnCodes error -body {
+ unload {} Unknown
+} -result {package "Unknown" is loaded statically and cannot be unloaded}
+test unload-1.7 {-nocomplain switch} {
+ unload -nocomplain {} Unknown
+} {}
set pkgua_loaded {}
set pkgua_detached {}
@@ -211,9 +215,28 @@ test unload-4.6 {basic unloading of unloadable package from a safe interpreter,
[child-trusted eval {list $pkgua_loaded $pkgua_detached $pkgua_unloaded}]
} {{. {} {}} {} {} {. . .}}
+test unload-5.1 {unload a module loaded from vfs} \
+ -constraints [list $dll $loaded testsimplefilesystem] \
+ -setup {
+ set dir [pwd]
+ cd $testDir
+ testsimplefilesystem 1
+ load simplefs:/pkgua$ext pkgua
+ } \
+ -body {
+ list [catch {unload simplefs:/pkgua$ext} msg] $msg
+ } \
+ -result {0 {}}
+
+
+
# cleanup
interp delete child
interp delete child-trusted
unset ext
::tcltest::cleanupTests
return
+
+# Local Variables:
+# mode: tcl
+# End: