Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | * tests/pkg/samename.tcl: test file for bug #1983 * tests/pkgMkIndex.test: * library/package.tcl: Fixed bug #1983, dealing with pkg_mkIndex incorrectly handling situations with two procs by the same name but in different namespaces (ie, foo::baz and bar::baz). |
|---|---|
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA1: |
356f51f836eb82551fac028035d01083 |
| User & Date: | ericm 2000-01-27 19:48:29.000 |
Context
|
2000-01-27
| ||
| 23:44 | * library/tcltest1.0/tcltest.tcl: Changed NormalizePath to normalizePath and exported it as a public... check-in: 336bed6b79 user: jenn tags: trunk | |
| 19:48 | * tests/pkg/samename.tcl: test file for bug #1983 * tests/pkgMkIndex.test: * library/package.tcl: F... check-in: 356f51f836 user: ericm tags: trunk | |
| 19:20 | * tests/pkgMkIndex.test: * doc/pkgMkIndex.n: * library/package.tcl: Per rfe #4097, optimized creatio... check-in: fc236223b3 user: ericm tags: trunk | |
Changes
Changes to library/package.tcl.
1 2 3 4 5 | # package.tcl -- # # utility procs formerly in init.tcl which can be loaded on demand # for package management. # | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 | # package.tcl -- # # utility procs formerly in init.tcl which can be loaded on demand # for package management. # # RCS: @(#) $Id: package.tcl,v 1.8 2000/01/27 19:48:29 ericm Exp $ # # Copyright (c) 1991-1993 The Regents of the University of California. # Copyright (c) 1994-1998 Sun Microsystems, Inc. # # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # |
| ︙ | ︙ | |||
281 282 283 284 285 286 287 |
# See what new namespaces appeared, and import commands
# from them. Only exported commands go into the index.
foreach ::tcl::x [::tcl::GetAllNamespaces] {
if {! [info exists ::tcl::namespaces($::tcl::x)]} {
namespace import -force ${::tcl::x}::*
}
| | < | | | | | | | | | | | | | | | | | | | | | | | > | 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 |
# See what new namespaces appeared, and import commands
# from them. Only exported commands go into the index.
foreach ::tcl::x [::tcl::GetAllNamespaces] {
if {! [info exists ::tcl::namespaces($::tcl::x)]} {
namespace import -force ${::tcl::x}::*
}
# Figure out what commands appeared
foreach ::tcl::x [info commands] {
set ::tcl::newCmds($::tcl::x) 1
}
foreach ::tcl::x $::tcl::origCmds {
catch {unset ::tcl::newCmds($::tcl::x)}
}
foreach ::tcl::x [array names ::tcl::newCmds] {
# determine which namespace a command comes from
set ::tcl::abs [namespace origin $::tcl::x]
# special case so that global names have no leading
# ::, this is required by the unknown command
set ::tcl::abs [auto_qualify $::tcl::abs ::]
if {[string compare $::tcl::x $::tcl::abs]} {
# Name changed during qualification
set ::tcl::newCmds($::tcl::abs) 1
unset ::tcl::newCmds($::tcl::x)
}
}
}
}
# Look through the packages that appeared, and if there is
# a version provided, then record it
|
| ︙ | ︙ |
Added tests/pkg/samename.tcl.
> > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
package provide football 1.0
namespace eval ::pro:: {
#
# export only public functions.
#
namespace export {[a-z]*}
}
namespace eval ::college:: {
#
# export only public functions.
#
namespace export {[a-z]*}
}
proc ::pro::team {} {
puts "go packers!"
return true
}
proc ::college::team {} {
puts "go badgers!"
return true
}
|
Changes to tests/pkgMkIndex.test.
1 2 3 4 5 6 7 8 9 10 | # This file contains tests for the pkg_mkIndex command. # Note that the tests are limited to Tcl scripts only, there are no shared # libraries against which to test. # # Sourcing this file into Tcl runs the tests and generates output for # errors. No output means no errors were found. # # Copyright (c) 1998-1999 by Scriptics Corporation. # All rights reserved. # | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
# This file contains tests for the pkg_mkIndex command.
# Note that the tests are limited to Tcl scripts only, there are no shared
# libraries against which to test.
#
# Sourcing this file into Tcl runs the tests and generates output for
# errors. No output means no errors were found.
#
# Copyright (c) 1998-1999 by Scriptics Corporation.
# All rights reserved.
#
# RCS: @(#) $Id: pkgMkIndex.test,v 1.14 2000/01/27 19:48:30 ericm Exp $
if {[lsearch [namespace children] ::tcltest] == -1} {
package require tcltest
namespace import ::tcltest::*
}
set origDir [pwd]
|
| ︙ | ︙ | |||
344 345 346 347 348 349 350 351 352 353 354 355 356 357 |
# Tolerate "namespace import" at the global scope
test pkgMkIndex-11.1 {conflicting namespace imports} {
pkgtest::runIndex -lazy $fullPkgPath import.tcl
} {0 {{fubar:1.0 {tclPkgSetup {import.tcl source ::fubar::foo}}}}}
# cleanup
namespace delete pkgtest
cd $origDir
::tcltest::cleanupTests
return
| > > > > > > > > | 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 |
# Tolerate "namespace import" at the global scope
test pkgMkIndex-11.1 {conflicting namespace imports} {
pkgtest::runIndex -lazy $fullPkgPath import.tcl
} {0 {{fubar:1.0 {tclPkgSetup {import.tcl source ::fubar::foo}}}}}
# Verify that the auto load list generated is correct even when there
# is a proc name conflict between two namespaces (ie, ::foo::baz and
# ::bar::baz)
test pkgMkIndex-12.1 {same name procs in different namespace} {
pkgtest::runIndex -lazy $fullPkgPath samename.tcl
} {0 {{football:1.0 {tclPkgSetup {samename.tcl source {::college::team ::pro::team}}}}}}
# cleanup
namespace delete pkgtest
cd $origDir
::tcltest::cleanupTests
return
|