From d7019b7df70dfd4375c7952850fe26f1bec79520 Mon Sep 17 00:00:00 2001 From: dkf Date: Tue, 26 Jul 2011 20:00:23 +0000 Subject: Ensure that TclOO is properly found by all the various package mechanisms (by adding a dummy ifneeded script) and not just some of them. --- ChangeLog | 10 ++++++++-- generic/tclOO.c | 1 + tests/oo.test | 19 ++++++------------- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/ChangeLog b/ChangeLog index aad6742..bf320fc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,10 +1,16 @@ +2011-07-26 Donal K. Fellows + + * generic/tclOO.c (initScript): Ensure that TclOO is properly found by + all the various package mechanisms (by adding a dummy ifneeded script) + and not just some of them. + 2011-07-21 Jan Nijtmans - * win/tclWinPort.h: [Bug 3372130] Fix hypot math function with MSVC10 + * win/tclWinPort.h: [Bug 3372130]: Fix hypot math function with MSVC10 2011-07-19 Don Porter - * generic/tclUtil.c: [Bug 3371644] Repair failure to properly handle + * generic/tclUtil.c: [Bug 3371644]: Repair failure to properly handle * tests/util.test: (length == -1) scanning in TclConvertElement(). Thanks to Thomas Sader and Alexandre Ferrieux. diff --git a/generic/tclOO.c b/generic/tclOO.c index 9df3f53..8b76eeb 100644 --- a/generic/tclOO.c +++ b/generic/tclOO.c @@ -130,6 +130,7 @@ static const DeclaredClassMethod objMethods[] = { }; static char initScript[] = + "package ifneeded TclOO " TCLOO_PATCHLEVEL " {# Already present, OK?};" "namespace eval ::oo { variable version " TCLOO_VERSION " };" "namespace eval ::oo { variable patchlevel " TCLOO_PATCHLEVEL " };"; /* "tcl_findLibrary tcloo $oo::version $oo::version" */ diff --git a/tests/oo.test b/tests/oo.test index e8f770c..b12cb42 100644 --- a/tests/oo.test +++ b/tests/oo.test @@ -2,7 +2,7 @@ # Sourcing this file into Tcl runs the tests and generates output for errors. # No output means no errors were found. # -# Copyright (c) 2006-2008 Donal K. Fellows +# Copyright (c) 2006-2011 Donal K. Fellows # # See the file "license.terms" for information on usage and redistribution of # this file, and for a DISCLAIMER OF ALL WARRANTIES. @@ -29,15 +29,9 @@ if {[testConstraint memory]} { return [expr {$end - $tmp}] } } - -proc initInterpreter name { - $name eval [list package ifneeded TclOO [package provide TclOO] \ - [package ifneeded TclOO [package provide TclOO]]] -} test oo-0.1 {basic test of OO's ability to clean up its initial state} { interp create t - initInterpreter t t eval { package require TclOO } @@ -45,11 +39,11 @@ test oo-0.1 {basic test of OO's ability to clean up its initial state} { } {} test oo-0.2 {basic test of OO's ability to clean up its initial state} { set i [interp create] - initInterpreter $i interp eval $i { package require TclOO namespace delete :: } + interp delete $i } {} test oo-0.3 {basic test of OO's ability to clean up its initial state} -body { leaktest { @@ -72,7 +66,6 @@ test oo-0.5 {testing literal leak on interp delete} memory { } 0 test oo-0.6 {cleaning the core class pair; way #1} -setup { interp create t - initInterpreter t } -body { t eval { package require TclOO @@ -84,7 +77,6 @@ test oo-0.6 {cleaning the core class pair; way #1} -setup { } -result {0 {} 1 {invalid command name "object"}} test oo-0.7 {cleaning the core class pair; way #2} -setup { interp create t - initInterpreter t } -body { t eval { package require TclOO @@ -106,6 +98,10 @@ test oo-0.8 {leak in variable management} -setup { } -cleanup { foo destroy } -result 0 +test oo-0.9 {various types of presence of the TclOO package} { + list [lsearch -nocase -all -inline [package names] tcloo] \ + [package present TclOO] [package versions TclOO] +} [list TclOO $::oo::version $::oo::version] test oo-1.1 {basic test of OO functionality: no classes} { set result {} @@ -272,7 +268,6 @@ test oo-2.1 {basic test of OO functionality: constructor} -setup { # This is a bit complex because it needs to run in a sub-interp as # we're modifying the root object class's constructor interp create subinterp - initInterpreter subinterp subinterp eval { package require TclOO } @@ -340,7 +335,6 @@ test oo-3.1 {basic test of OO functionality: destructor} -setup { # This is a bit complex because it needs to run in a sub-interp as we're # modifying the root object class's constructor interp create subinterp - initInterpreter subinterp subinterp eval { package require TclOO } @@ -361,7 +355,6 @@ test oo-3.2 {basic test of OO functionality: destructor} -setup { # This is a bit complex because it needs to run in a sub-interp as # we're modifying the root object class's constructor interp create subinterp - initInterpreter subinterp subinterp eval { package require TclOO } -- cgit v0.12