From 597760fa003d1d510853e15a4c74b3ffd70b3e98 Mon Sep 17 00:00:00 2001 From: dgp Date: Mon, 25 Feb 2013 14:54:14 +0000 Subject: 3605719,3605720 Test independence. Thanks Rolf Ade for patches. --- ChangeLog | 5 +++++ tests/assocd.test | 22 ++++++++++++++-------- tests/basic.test | 14 ++++++++++++-- 3 files changed, 31 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index e2c7910..c1b3640 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2013-02-25 Don Porter + + * tests/assocd.test: [Bugs 3605719,3605720] Test independence. + * tests/basic.test: Thanks Rolf Ade for patches. + 2013-02-22 Don Porter * generic/tclCompile.c: Shift more burden of smart cleanup onto the diff --git a/tests/assocd.test b/tests/assocd.test index f07d466..46a813a 100644 --- a/tests/assocd.test +++ b/tests/assocd.test @@ -31,15 +31,21 @@ test assocd-1.4 {testing setting assoc data} testsetassocdata { testsetassocdata abc "abc d e f" } "" -test assocd-2.1 {testing getting assoc data} testgetassocdata { - testgetassocdata a -} 2 -test assocd-2.2 {testing getting assoc data} testgetassocdata { - testgetassocdata 123 -} 456 -test assocd-2.3 {testing getting assoc data} testgetassocdata { +test assocd-2.1 {testing getting assoc data} -setup { + testsetassocdata a 2 +} -constraints {testgetassocdata} -body { + testgetassocdata a +} -result 2 +test assocd-2.2 {testing getting assoc data} -setup { + testsetassocdata 123 456 +} -constraints {testgetassocdata} -body { + testgetassocdata 123 +} -result 456 +test assocd-2.3 {testing getting assoc data} -setup { + testsetassocdata abc "abc d e f" +} -constraints {testgetassocdata} -body { testgetassocdata abc -} {abc d e f} +} -result "abc d e f" test assocd-2.4 {testing getting assoc data} testgetassocdata { testgetassocdata xxx } "" diff --git a/tests/basic.test b/tests/basic.test index 0bad4ed..91e4d6c 100644 --- a/tests/basic.test +++ b/tests/basic.test @@ -264,14 +264,24 @@ test basic-18.4 {TclRenameCommand, bad new name} { } rename test_ns_basic::p :::george::martha } {} -test basic-18.5 {TclRenameCommand, new name must not already exist} { +test basic-18.5 {TclRenameCommand, new name must not already exist} -setup { + if {![llength [info commands :::george::martha]]} { + catch {namespace delete {*}[namespace children :: test_ns_*]} + namespace eval test_ns_basic { + proc p {} { + return "p in [namespace current]" + } + } + rename test_ns_basic::p :::george::martha + } +} -body { namespace eval test_ns_basic { proc q {} { return 42 } } list [catch {rename test_ns_basic::q :::george::martha} msg] $msg -} {1 {can't rename to ":::george::martha": command already exists}} +} -result {1 {can't rename to ":::george::martha": command already exists}} test basic-18.6 {TclRenameCommand, check for command shadowing by newly renamed cmd} { catch {namespace delete {*}[namespace children :: test_ns_*]} catch {rename p ""} -- cgit v0.12