summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/pkg.test76
1 files changed, 74 insertions, 2 deletions
diff --git a/tests/pkg.test b/tests/pkg.test
index 412d478..d379eb8 100644
--- a/tests/pkg.test
+++ b/tests/pkg.test
@@ -9,7 +9,7 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
-# RCS: @(#) $Id: pkg.test,v 1.2 1998/09/14 18:40:12 stanton Exp $
+# RCS: @(#) $Id: pkg.test,v 1.3 1999/03/10 05:52:51 stanton Exp $
if {[string compare test [info procs test]] == 1} then {source defs}
@@ -483,7 +483,7 @@ test pkg-3.52 {Tcl_PackageCmd procedure, "vsatisfies" option} {
} {0}
test pkg-3.53 {Tcl_PackageCmd procedure, "versions" option} {
list [catch {package foo} msg] $msg
-} {1 {bad option "foo": should be forget, ifneeded, names, provide, require, unknown, vcompare, versions, or vsatisfies}}
+} {1 {bad option "foo": should be forget, ifneeded, names, present, provide, require, unknown, vcompare, versions, or vsatisfies}}
# No tests for FindPackage; can't think up anything detectable
# errors.
@@ -555,6 +555,78 @@ test pkg-6.9 {ComparePkgVersions procedure} {
package vsatisfies 2 1
} {0}
+test pkg-7.1 {Tcl_PkgPresent procedure, any version} {
+ package forget t
+ package provide t 2.4
+ package present t
+} {2.4}
+test pkg-7.2 {Tcl_PkgPresent procedure, correct version} {
+ package forget t
+ package provide t 2.4
+ package present t 2.4
+} {2.4}
+test pkg-7.3 {Tcl_PkgPresent procedure, satisfying version} {
+ package forget t
+ package provide t 2.4
+ package present t 2.0
+} {2.4}
+test pkg-7.4 {Tcl_PkgPresent procedure, not satisfying version} {
+ package forget t
+ package provide t 2.4
+ list [catch {package present t 2.6} msg] $msg
+} {1 {version conflict for package "t": have 2.4, need 2.6}}
+test pkg-7.5 {Tcl_PkgPresent procedure, not satisfying version} {
+ package forget t
+ package provide t 2.4
+ list [catch {package present t 1.0} msg] $msg
+} {1 {version conflict for package "t": have 2.4, need 1.0}}
+test pkg-7.6 {Tcl_PkgPresent procedure, exact version} {
+ package forget t
+ package provide t 2.4
+ package present -exact t 2.4
+} {2.4}
+test pkg-7.7 {Tcl_PkgPresent procedure, not exact version} {
+ package forget t
+ package provide t 2.4
+ list [catch {package present -exact t 2.3} msg] $msg
+} {1 {version conflict for package "t": have 2.4, need 2.3}}
+test pkg-7.8 {Tcl_PkgPresent procedure, unknown package} {
+ package forget t
+ list [catch {package present t} msg] $msg
+} {1 {package t is not present}}
+test pkg-7.9 {Tcl_PkgPresent procedure, unknown package} {
+ package forget t
+ list [catch {package present t 2.4} msg] $msg
+} {1 {package t 2.4 is not present}}
+test pkg-7.10 {Tcl_PkgPresent procedure, unknown package} {
+ package forget t
+ list [catch {package present -exact t 2.4} msg] $msg
+} {1 {package t 2.4 is not present}}
+test pkg-7.11 {Tcl_PackageCmd procedure, "present" option} {
+ list [catch {package present} msg] $msg
+} {1 {wrong # args: should be "package present ?-exact? package ?version?"}}
+test pkg-7.12 {Tcl_PackageCmd procedure, "present" option} {
+ list [catch {package present a b c} msg] $msg
+} {1 {wrong # args: should be "package present ?-exact? package ?version?"}}
+test pkg-7.13 {Tcl_PackageCmd procedure, "present" option} {
+ list [catch {package present -exact a b c} msg] $msg
+} {1 {wrong # args: should be "package present ?-exact? package ?version?"}}
+test pkg-7.14 {Tcl_PackageCmd procedure, "present" option} {
+ list [catch {package present -bs a b} msg] $msg
+} {1 {wrong # args: should be "package present ?-exact? package ?version?"}}
+test pkg-7.15 {Tcl_PackageCmd procedure, "present" option} {
+ list [catch {package present x a.b} msg] $msg
+} {1 {expected version number but got "a.b"}}
+test pkg-7.16 {Tcl_PackageCmd procedure, "present" option} {
+ list [catch {package present -exact x a.b} msg] $msg
+} {1 {expected version number but got "a.b"}}
+test pkg-7.17 {Tcl_PackageCmd procedure, "present" option} {
+ list [catch {package present -exact x} msg] $msg
+} {1 {wrong # args: should be "package present ?-exact? package ?version?"}}
+test pkg-7.18 {Tcl_PackageCmd procedure, "present" option} {
+ list [catch {package present -exact} msg] $msg
+} {1 {wrong # args: should be "package present ?-exact? package ?version?"}}
+
set auto_path $oldPath
package unknown $oldPkgUnknown
concat