diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2016-03-11 09:33:35 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2016-03-11 09:33:35 (GMT) |
commit | 43e4e54e29bef2ddad191d36a729bdd3e916a7ba (patch) | |
tree | ef7663727e70f36e3cb47a4137119cd18e4682b3 /tests | |
parent | b42806f3501da6281a164b3b4bacd7b53d42be3a (diff) | |
parent | 48862a2ffe39aa9249dbf0b8f4a867c87dd296bc (diff) | |
download | tcl-43e4e54e29bef2ddad191d36a729bdd3e916a7ba.zip tcl-43e4e54e29bef2ddad191d36a729bdd3e916a7ba.tar.gz tcl-43e4e54e29bef2ddad191d36a729bdd3e916a7ba.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.test | 38 |
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 {} |