From fabd3e7dc8882faee98b35feb738939c197e23b5 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Sat, 26 Nov 2016 17:47:27 +0000 Subject: Add "package files" testcase, which doesn give the right answer. So still work to do --- tests/load.test | 4 ++-- tests/package.test | 12 ++++++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/tests/load.test b/tests/load.test index 7c4b47f..94451e9 100644 --- a/tests/load.test +++ b/tests/load.test @@ -197,14 +197,14 @@ test load-8.2 {TclGetLoadedPackages procedure} -body { } -returnCodes error -result {could not find interpreter "gorp"} test load-8.3a {TclGetLoadedPackages procedure} [list teststaticpkg $dll $loaded] { lsort -index 1 [info loaded {}] -} [lsort -index 1 [list {{} Double} {{} More} {{} Another} {{} Test} [list [file join $testDir pkga$ext] Pkga] [list [file join $testDir pkgb$ext] Pkgb] {*}$alreadyLoaded]] +} [lsort -index 1 [list {{} Double} {{} More} {{} Another} {{} Test} [list [file join $testDir pkga$ext] Pkga] [list [file join $testDir pkgb$ext] Pkgb] [list [file join $testDir pkge$ext] Pkge] {*}$alreadyLoaded]] test load-8.3b {TclGetLoadedPackages procedure} [list teststaticpkg $dll $loaded] { lsort -index 1 [info loaded child] } [lsort -index 1 [list {{} Test} [list [file join $testDir pkgb$ext] Pkgb]]] test load-8.4 {TclGetLoadedPackages procedure} [list $dll $loaded teststaticpkg] { load [file join $testDir pkgb$ext] pkgb list [lsort -index 1 [info loaded {}]] [lsort [info commands pkgb_*]] -} [list [lsort -index 1 [concat [list [list [file join $testDir pkgb$ext] Pkgb] {{} Double} {{} More} {{} Another} {{} Test} [list [file join $testDir pkga$ext] Pkga]] $alreadyLoaded]] {pkgb_demo pkgb_sub pkgb_unsafe}] +} [list [lsort -index 1 [concat [list [list [file join $testDir pkgb$ext] Pkgb] [list [file join $testDir pkge$ext] Pkge] {{} Double} {{} More} {{} Another} {{} Test} [list [file join $testDir pkga$ext] Pkga]] $alreadyLoaded]] {pkgb_demo pkgb_sub pkgb_unsafe}] interp delete child test load-9.1 {Tcl_StaticPackage, load already-loaded package into another interp} \ diff --git a/tests/package.test b/tests/package.test index 99f9f06..7e8a42d 100644 --- a/tests/package.test +++ b/tests/package.test @@ -55,8 +55,8 @@ test package-1.7 {pkg::create gives correct output for 1 direct source} { ::pkg::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 {pkg::create gives correct output for 2 direct sources} { - ::pkg::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]]} + list [::pkg::create -name foo -version 1.0 -source test.tcl -source test2.tcl] [package files foo] +} {{package ifneeded foo 1.0 [list source [file join $dir test.tcl]]\n[list source [file join $dir test2.tcl]]} {}} test package-1.9 {pkg::create gives correct output for 1 direct load} { ::pkg::create -name foo -version 1.0 -load test.so } {package ifneeded foo 1.0 [list load [file join $dir test.so]]} @@ -870,6 +870,14 @@ test package-5.2 {TclFreePackageInfo procedure} -body { } foo eval package require x 3.1 } -returnCodes error -match glob -result * +test package-5.3 {package files} -body { + interp create foo + foo eval { + package ifneeded t 2.4 {package provide t 2.4;package require http} + } + foo eval package require t 2.4 + foo eval {list [package files http] [package files t]} +} -result "[list {}] [file join $tcl_library http http.tcl]" test package-6.1 {CheckVersion procedure} { package vcompare 1 2.1 -- cgit v0.12