diff options
Diffstat (limited to 'tests/pkgMkIndex.test')
-rw-r--r-- | tests/pkgMkIndex.test | 64 |
1 files changed, 31 insertions, 33 deletions
diff --git a/tests/pkgMkIndex.test b/tests/pkgMkIndex.test index 9f3b8fa..990bb5f 100644 --- a/tests/pkgMkIndex.test +++ b/tests/pkgMkIndex.test @@ -8,10 +8,8 @@ # Copyright (c) 1998-1999 by Scriptics Corporation. # All rights reserved. -if {[lsearch [namespace children] ::tcltest] == -1} { - package require tcltest 2 - namespace import -force ::tcltest::* -} +package require tcltest 2 +namespace import ::tcltest::* set fullPkgPath [makeDirectory pkg] @@ -46,7 +44,7 @@ proc pkgtest::parseArgs { args } { set a [lindex $args $iarg] if {[regexp {^-} $a]} { lappend options $a - if {[string compare -load $a] == 0} { + if {$a eq "-load"} { incr iarg lappend options [lindex $args $iarg] } @@ -82,12 +80,12 @@ proc pkgtest::parseIndex { filePath } { $slave eval { rename package package_original proc package { args } { - if {[string compare [lindex $args 0] ifneeded] == 0} { + if {[lindex $args 0] eq "ifneeded"} { set pkg [lindex $args 1] set ver [lindex $args 2] set ::PKGS($pkg:$ver) [lindex $args 3] } else { - return [eval package_original $args] + return [package_original {*}$args] } } array set ::PKGS {} @@ -112,9 +110,9 @@ proc pkgtest::parseIndex { filePath } { foreach k [lsort [array names P]] { lappend PKGS $k $P($k) } - } err]} { - set ei $::errorInfo - set ec $::errorCode + } err opts]} { + set ei [dict get $opts -errorinfo] + set ec [dict get $opts -errorcode] catch {interp delete $slave} @@ -146,7 +144,7 @@ proc pkgtest::parseIndex { filePath } { # 1: the error result if element 0 was 1 proc pkgtest::createIndex { args } { - set parsed [eval parseArgs $args] + set parsed [parseArgs {*}$args] set options [lindex $parsed 0] set dirPath [lindex $parsed 1] set patternList [lindex $parsed 2] @@ -155,7 +153,7 @@ proc pkgtest::createIndex { args } { if {[catch { file delete [file join $dirPath pkgIndex.tcl] - eval pkg_mkIndex $options [list $dirPath] $patternList + pkg_mkIndex {*}$options $dirPath {*}$patternList } err]} { return [list 1 $err] } @@ -229,7 +227,7 @@ proc makePkgList { inList } { proc pkgtest::runCreatedIndex {rv args} { if {[lindex $rv 0] == 0} { - set parsed [eval parseArgs $args] + set parsed [parseArgs {*}$args] set dirPath [lindex $parsed 1] set idxFile [file join $dirPath pkgIndex.tcl] @@ -246,8 +244,8 @@ proc pkgtest::runCreatedIndex {rv args} { return $result } proc pkgtest::runIndex { args } { - set rv [eval createIndex $args] - return [eval [list runCreatedIndex $rv] $args] + set rv [createIndex {*}$args] + return [runCreatedIndex $rv {*}$args] } # If there is no match to the patterns, make sure the directory hasn't @@ -560,17 +558,17 @@ removeFile [file join pkg circ3.tcl] set x [file join [file dirname [info nameofexecutable]] dltest \ pkga[info sharedlibextension]] set dll "[file tail $x]Required" -::tcltest::testConstraint $dll [file exists $x] +testConstraint $dll [file exists $x] if {[testConstraint $dll]} { -makeFile { + makeFile { # This package provides Pkga, which is also provided by a DLL. package provide Pkga 1.0 proc pkga_neq { x } { return [expr {! [pkgq_eq $x]}] } } [file join pkg pkga.tcl] -file copy -force $x $fullPkgPath + file copy -force $x $fullPkgPath } testConstraint exec [llength [info commands ::exec]] @@ -596,8 +594,8 @@ test pkgMkIndex-10.2 {package in DLL hidden by -load} [list exec $dll] { } {0 {}} if {[testConstraint $dll]} { -file delete -force [file join $fullPkgPath [file tail $x]] -removeFile [file join pkg pkga.tcl] + file delete -force [file join $fullPkgPath [file tail $x]] + removeFile [file join pkg pkga.tcl] } # Tolerate "namespace import" at the global scope @@ -671,24 +669,24 @@ test pkgMkIndex-13.1 {proc names with embedded spaces} { removeFile [file join pkg spacename.tcl] -# Test the pkg_compareExtension helper function -test pkgMkIndex-14.1 {pkg_compareExtension} {unixOnly} { - pkg_compareExtension foo.so .so +# Test the tcl::Pkg::CompareExtension helper function +test pkgMkIndex-14.1 {tcl::Pkg::CompareExtension} {unix} { + tcl::Pkg::CompareExtension foo.so .so } 1 -test pkgMkIndex-14.2 {pkg_compareExtension} {unixOnly} { - pkg_compareExtension foo.so.bar .so +test pkgMkIndex-14.2 {tcl::Pkg::CompareExtension} {unix} { + tcl::Pkg::CompareExtension foo.so.bar .so } 0 -test pkgMkIndex-14.3 {pkg_compareExtension} {unixOnly} { - pkg_compareExtension foo.so.1 .so +test pkgMkIndex-14.3 {tcl::Pkg::CompareExtension} {unix} { + tcl::Pkg::CompareExtension foo.so.1 .so } 1 -test pkgMkIndex-14.4 {pkg_compareExtension} {unixOnly} { - pkg_compareExtension foo.so.1.2 .so +test pkgMkIndex-14.4 {tcl::Pkg::CompareExtension} {unix} { + tcl::Pkg::CompareExtension foo.so.1.2 .so } 1 -test pkgMkIndex-14.5 {pkg_compareExtension} {unixOnly} { - pkg_compareExtension foo .so +test pkgMkIndex-14.5 {tcl::Pkg::CompareExtension} {unix} { + tcl::Pkg::CompareExtension foo .so } 0 -test pkgMkIndex-14.6 {pkg_compareExtension} {unixOnly} { - pkg_compareExtension foo.so.1.2.bar .so +test pkgMkIndex-14.6 {tcl::Pkg::CompareExtension} {unix} { + tcl::Pkg::CompareExtension foo.so.1.2.bar .so } 0 # cleanup |