summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2016-03-11 09:33:35 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2016-03-11 09:33:35 (GMT)
commita284f6ce98ab3ba17bfef4ba1216feac2c720633 (patch)
treeef7663727e70f36e3cb47a4137119cd18e4682b3 /tests
parent06d40a2add362702cee3dd03ab5a9b1ae13805b8 (diff)
parent61616431840c438a6934e3745b7b422f2a1d53c8 (diff)
downloadtcl-a284f6ce98ab3ba17bfef4ba1216feac2c720633.zip
tcl-a284f6ce98ab3ba17bfef4ba1216feac2c720633.tar.gz
tcl-a284f6ce98ab3ba17bfef4ba1216feac2c720633.tar.bz2
Allow unstable Tcl releases to use unstable packages by default (this makes "package require Tk" find the expected 8.7a0 version in stead of 8.6). Make many "package" test-cases work even when the environment variable TCL_PKG_PREFER_LATEST is set.
Diffstat (limited to 'tests')
-rw-r--r--tests/package.test38
1 files changed, 28 insertions, 10 deletions
diff --git a/tests/package.test b/tests/package.test
index da778f1..49346d8 100644
--- a/tests/package.test
+++ b/tests/package.test
@@ -17,6 +17,11 @@ if {"::tcltest" ni [namespace children]} {
namespace import -force ::tcltest::*
}
+::tcltest::loadTestedCommands
+catch [list package require -exact Tcltest [info patchlevel]]
+
+testConstraint testpreferstable [llength [info commands testpreferstable]]
+
# Do all this in a slave interp to avoid garbaging the package list
set i [interp create]
tcltest::loadIntoSlaveInterpreter $i {*}$argv
@@ -569,7 +574,8 @@ test package-3.44 {Tcl_PkgRequire: exact version matching (1578344)} -setup {
} -returnCodes error -cleanup {
package forget demo
} -result {version conflict for package "demo": have 1.2.3, need exactly 1.2}
-test package-3.50 {Tcl_PkgRequire procedure, picking best stable version} -setup {
+test package-3.50 {Tcl_PkgRequire procedure, picking best stable version} -constraints testpreferstable -setup {
+ testpreferstable
package forget t
set x xxx
} -body {
@@ -1233,9 +1239,11 @@ proc prefer {args} {
}
}
-test package-13.0 {package prefer defaults} {
+test package-13.0 {package prefer defaults} -constraints testpreferstable -setup {
+ testpreferstable
+} -body {
prefer
-} stable
+} -result stable
test package-13.1 {package prefer defaults} -body {
set ::env(TCL_PKG_PREFER_LATEST) stable ;# value not relevant!
prefer
@@ -1250,15 +1258,25 @@ test package-14.1 {bogus argument} -returnCodes error -body {
package prefer foo
} -result {bad preference "foo": must be latest or stable}
-test package-15.0 {set, keep} {package prefer stable} stable
-test package-15.1 {set stable, keep} {prefer stable} {stable stable}
-test package-15.2 {set latest, change} {prefer latest} {stable latest}
-test package-15.3 {set latest, keep} {
+test package-15.0 {set, keep} -constraints testpreferstable -setup {
+ testpreferstable
+} -body {package prefer stable} -result stable
+test package-15.1 {set stable, keep} -constraints testpreferstable -setup {
+ testpreferstable
+} -body {prefer stable} -result {stable stable}
+test package-15.2 {set latest, change} -constraints testpreferstable -setup {
+ testpreferstable
+} -body {prefer latest} -result {stable latest}
+test package-15.3 {set latest, keep} -constraints testpreferstable -setup {
+ testpreferstable
+} -body {
prefer latest latest
-} {stable latest latest}
-test package-15.4 {set stable, rejected} {
+} -result {stable latest latest}
+test package-15.4 {set stable, rejected} -constraints testpreferstable -setup {
+ testpreferstable
+} -body {
prefer latest stable
-} {stable latest latest}
+} -result {stable latest latest}
rename prefer {}