summaryrefslogtreecommitdiffstats
path: root/tests/pkgMkIndex.test
diff options
context:
space:
mode:
authorstanton <stanton>1999-04-16 00:46:29 (GMT)
committerstanton <stanton>1999-04-16 00:46:29 (GMT)
commit97464e6cba8eb0008cf2727c15718671992b913f (patch)
treece9959f2747257d98d52ec8d18bf3b0de99b9535 /tests/pkgMkIndex.test
parenta8c96ddb94d1483a9de5e340b740cb74ef6cafa7 (diff)
downloadtcl-97464e6cba8eb0008cf2727c15718671992b913f.zip
tcl-97464e6cba8eb0008cf2727c15718671992b913f.tar.gz
tcl-97464e6cba8eb0008cf2727c15718671992b913f.tar.bz2
merged tcl 8.1 branch back into the main trunk
Diffstat (limited to 'tests/pkgMkIndex.test')
-rw-r--r--tests/pkgMkIndex.test76
1 files changed, 52 insertions, 24 deletions
diff --git a/tests/pkgMkIndex.test b/tests/pkgMkIndex.test
index 5b14989..e49cf25 100644
--- a/tests/pkgMkIndex.test
+++ b/tests/pkgMkIndex.test
@@ -5,20 +5,33 @@
# Sourcing this file into Tcl runs the tests and generates output for
# errors. No output means no errors were found.
#
-# Copyright (c) 1998 by Scriptics Corporation.
+# Copyright (c) 1998-1999 by Scriptics Corporation.
# All rights reserved.
#
-# RCS: @(#) $Id: pkgMkIndex.test,v 1.5 1999/03/31 22:37:17 welch Exp $
+# RCS: @(#) $Id: pkgMkIndex.test,v 1.6 1999/04/16 00:47:32 stanton Exp $
-if {[string compare test [info procs test]] == 1} then {source defs}
+if {[lsearch [namespace children] ::tcltest] == -1} {
+ source [file join [pwd] [file dirname [info script]] defs.tcl]
+}
+
+# temporarily copy the pkg and pkg1 dirs from testsDir to tmpDir
+if {"$::tcltest::testsDir" != "$::tcltest::workingDir"} {
+ set origPkgDir [file join $::tcltest::testsDir pkg]
+ set newPkgDir [file join $::tcltest::workingDir pkg]
+ if {![catch {file copy $origPkgDir $newPkgDir}]} {
+ set removePkgDir 1
+ }
+ if {![catch {file copy "${origPkgDir}1" "${newPkgDir}1"}]} {
+ set removePkg1Dir 1
+ }
+}
# Add the pkg1 directory to auto_path, so that its packages can be found.
# packages in pkg1 are used to test indexing of packages in pkg.
# Make sure that the path to pkg1 is absolute.
-set scriptDir [file dirname [info script]]
set oldDir [pwd]
-lappend auto_path [file join [pwd] $scriptDir pkg1]
+lappend auto_path [file join $::tcltest::workingDir pkg1]
namespace eval pkgtest {
# Namespace for procs we can discard
@@ -316,20 +329,19 @@ test pkgMkIndex-9.1 {circular packages} {
pkgtest::runIndex pkg circ1.tcl circ2.tcl circ3.tcl
} {0 {{circ1:1.0 {tclPkgSetup {circ1.tcl source {::circ1::c1-1 ::circ1::c1-2 ::circ1::c1-3 ::circ1::c1-4}}}} {circ2:1.0 {tclPkgSetup {circ2.tcl source {::circ2::c2-1 ::circ2::c2-2}}}} {circ3:1.0 {tclPkgSetup {circ3.tcl source ::circ3::c3-1}}}}}
-# Try to find one of the DLLs in the dltest directory
-set x [file join [pwd] [file dirname [info script]]]
-set x [file join $x ../unix/dltest/pkga[info sharedlibextension]]
-if {[file exists $x]} {
+# Some tests require the existence of one of the DLLs in the dltest directory
+set x [file join [file dirname [info nameofexecutable]] dltest \
+ pkga[info sharedlibextension]]
+set dll "[file tail $x]Required"
+set ::tcltest::testConfig($dll) [file exists $x]
+
+test pkgMkIndex-10.1 {package in DLL and script} $dll {
file copy -force $x pkg
- test pkgMkIndex-10.1 {package in DLL and script} {
- pkgtest::runIndex pkg pkga[info sharedlibextension] pkga.tcl
- } {0 {{Pkga:1.0 {tclPkgSetup {pkga.so load {pkga_eq pkga_quote}} {pkga.tcl source pkga_neq}}}}}
- test pkgMkIndex-10.2 {package in DLL hidden by -load} {
- pkgtest::runIndex -load Pkg* -- pkg pkga[info sharedlibextension]
- } {0 {}}
-} else {
- puts "Skipping pkgMkIndex-10.1 (index of DLL and script)"
-}
+ pkgtest::runIndex pkg pkga[info sharedlibextension] pkga.tcl
+} "0 {{Pkga:1.0 {tclPkgSetup {pkga[info sharedlibextension] load {pkga_eq pkga_quote}} {pkga.tcl source pkga_neq}}}}"
+test pkgMkIndex-10.2 {package in DLL hidden by -load} $dll {
+ pkgtest::runIndex -load Pkg* -- pkg pkga[info sharedlibextension]
+} {0 {}}
# Tolerate "namespace import" at the global scope
@@ -337,11 +349,27 @@ test pkgMkIndex-11.1 {conflicting namespace imports} {
pkgtest::runIndex pkg import.tcl
} {0 {{fubar:1.0 {tclPkgSetup {import.tcl source ::fubar::foo}}}}}
-
-#
# cleanup
-#
-if {![info exist TESTS]} {
- file delete [file join pkg pkgIndex.tcl]
- namespace delete pkgtest
+namespace delete pkgtest
+cd $::tcltest::workingDir
+if {[info exists removePkgDir]} {
+ # strange error deleting the pkg dir only once--needs be done twice!
+ catch {file delete -force $newPkgDir}
+ catch {file delete -force $newPkgDir}
+}
+if {[info exists removePkg1Dir]} {
+ catch {file delete -force "${newPkgDir}1"}
}
+::tcltest::cleanupTests
+return
+
+
+
+
+
+
+
+
+
+
+