summaryrefslogtreecommitdiffstats
path: root/tests/package.test
diff options
context:
space:
mode:
authorericm <ericm>2000-02-01 01:14:00 (GMT)
committerericm <ericm>2000-02-01 01:14:00 (GMT)
commitacb2f260bec04797bce0d16b709b530c511fe87f (patch)
tree112da6d0b67c743bbc7eec435cfb6c42345bd653 /tests/package.test
parentbfc121a8bd79c18c8d1b7760be65a4db3ad18bfd (diff)
downloadtcl-acb2f260bec04797bce0d16b709b530c511fe87f.zip
tcl-acb2f260bec04797bce0d16b709b530c511fe87f.tar.gz
tcl-acb2f260bec04797bce0d16b709b530c511fe87f.tar.bz2
* tests/package.test:
* library/tclIndex: * library/package.tcl: Added ::package namespace and ::package::create function. * library/init.tcl: Fixed problem with auto_load and determining if commands were loaded. * library/auto.tcl: "Fixed" issues with $ in files to be auto indexed. * doc/Package.n: New man page for package::create function. * doc/pkgMkIndex.n: Added additional information. * doc/library.n: Added additional qualification regarding auto_mkindex.
Diffstat (limited to 'tests/package.test')
-rw-r--r--tests/package.test71
1 files changed, 71 insertions, 0 deletions
diff --git a/tests/package.test b/tests/package.test
new file mode 100644
index 0000000..0262e31
--- /dev/null
+++ b/tests/package.test
@@ -0,0 +1,71 @@
+# This file contains tests for the ::package::* commands.
+# Note that the tests are limited to Tcl scripts only, there are no shared
+# libraries against which to test.
+#
+# Sourcing this file into Tcl runs the tests and generates output for
+# errors. No output means no errors were found.
+#
+# Copyright (c) 1998-1999 by Scriptics Corporation.
+# All rights reserved.
+#
+# RCS: @(#) $Id: package.test,v 1.1 2000/02/01 01:14:02 ericm Exp $
+
+if {[lsearch [namespace children] ::tcltest] == -1} {
+ package require tcltest
+ namespace import ::tcltest::*
+}
+
+test package-1.1 {package::create gives error on insufficient args} {
+ catch {::package::create}
+} 1
+test package-1.2 {package::create gives error on bad args} {
+ catch {::package::create -foo bar -bar baz -baz boo}
+} 1
+test package-1.3 {package::create gives error on no value given} {
+ catch {::package::create -name foo -version 1.0 -source test.tcl -load}
+} 1
+test package-1.4 {package::create gives error on no name given} {
+ catch {::package::create -version 1.0 -source test.tcl -load foo.so}
+} 1
+test package-1.5 {package::create gives error on no version given} {
+ catch {::package::create -name foo -source test.tcl -load foo.so}
+} 1
+test package-1.6 {package::create gives error on no source or load options} {
+ catch {::package::create -name foo -version 1.0 -version 2.0}
+} 1
+test package-1.7 {package::create gives correct output for 1 direct source} {
+ ::package::create -name foo -version 1.0 -source test.tcl
+} {package ifneeded foo 1.0 [list source [file join $dir test.tcl]]}
+test package-1.8 {package::create gives correct output for 2 direct sources} {
+ ::package::create -name foo -version 1.0 -source test.tcl -source test2.tcl
+} {package ifneeded foo 1.0 [list source [file join $dir test.tcl]]\n[list source [file join $dir test2.tcl]]}
+test package-1.9 {package::create gives correct output for 1 direct load} {
+ ::package::create -name foo -version 1.0 -load test.so
+} {package ifneeded foo 1.0 [list load [file join $dir test.so]]}
+test package-1.10 {package::create gives correct output for 2 direct loads} {
+ ::package::create -name foo -version 1.0 -load test.so -load test2.so
+} {package ifneeded foo 1.0 [list load [file join $dir test.so]]\n[list load [file join $dir test2.so]]}
+test package-1.11 {package::create gives correct output for 1 lazy source} {
+ ::package::create -name foo -version 1.0 -source {test.tcl {foo bar}}
+} {package ifneeded foo 1.0 [list tclPkgSetup $dir foo 1.0 {{test.tcl source {foo bar}}}]}
+test package-1.12 {package::create gives correct output for 2 lazy sources} {
+ ::package::create -name foo -version 1.0 -source {test.tcl {foo bar}} \
+ -source {test2.tcl {baz boo}}
+} {package ifneeded foo 1.0 [list tclPkgSetup $dir foo 1.0 {{test.tcl source {foo bar}} {test2.tcl source {baz boo}}}]}
+test package-1.13 {package::create gives correct output for 1 lazy load} {
+ ::package::create -name foo -version 1.0 -load {test.so {foo bar}}
+} {package ifneeded foo 1.0 [list tclPkgSetup $dir foo 1.0 {{test.so load {foo bar}}}]}
+test package-1.14 {package::create gives correct output for 2 lazy loads} {
+ ::package::create -name foo -version 1.0 -load {test.so {foo bar}} \
+ -load {test2.so {baz boo}}
+} {package ifneeded foo 1.0 [list tclPkgSetup $dir foo 1.0 {{test.so load {foo bar}} {test2.so load {baz boo}}}]}
+test package-1.15 {package::create gives correct output for 1 each, direct} {
+ ::package::create -name foo -version 1.0 -source test.tcl -load test2.so
+} {package ifneeded foo 1.0 [list load [file join $dir test2.so]]\n[list source [file join $dir test.tcl]]}
+test package-1.16 {package::create gives correct output for 1 direct, 1 lazy} {
+ ::package::create -name foo -version 1.0 -source test.tcl \
+ -source {test2.tcl {foo bar}}
+} {package ifneeded foo 1.0 [list source [file join $dir test.tcl]]\n[list tclPkgSetup $dir foo 1.0 {{test2.tcl source {foo bar}}}]}
+
+::tcltest::cleanupTests
+return