diff options
author | dkf <donal.k.fellows@manchester.ac.uk> | 2017-06-22 22:03:06 (GMT) |
---|---|---|
committer | dkf <donal.k.fellows@manchester.ac.uk> | 2017-06-22 22:03:06 (GMT) |
commit | 3e1f74a42db81eb1bd0b963a6ce60f1c44b1bf7c (patch) | |
tree | d2971482ae96592884ec9cd5869af20851090c29 /tests | |
parent | 2570da989eed0e3768e8c6aa4535c1542695bb9c (diff) | |
parent | 4bcc67eec81872423901389198828d4679d7777d (diff) | |
download | tcl-3e1f74a42db81eb1bd0b963a6ce60f1c44b1bf7c.zip tcl-3e1f74a42db81eb1bd0b963a6ce60f1c44b1bf7c.tar.gz tcl-3e1f74a42db81eb1bd0b963a6ce60f1c44b1bf7c.tar.bz2 |
Implement TIP #473: Allow a Defined Target Namespace in oo::copy
Diffstat (limited to 'tests')
-rw-r--r-- | tests/oo.test | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/tests/oo.test b/tests/oo.test index ae36f87..5f87837 100644 --- a/tests/oo.test +++ b/tests/oo.test @@ -2013,6 +2013,41 @@ test oo-15.10 {variable binding must not bleed through oo::copy} -setup { } -cleanup { FooClass destroy } -result {foo bar grill bar} +test oo-15.11 {OO: object cloning} -returnCodes error -body { + oo::copy +} -result {wrong # args: should be "oo::copy sourceName ?targetName? ?targetNamespace?"} +test oo-15.12 {OO: object cloning with target NS} -setup { + oo::class create Super + oo::class create Cls {superclass Super} +} -body { + namespace eval ::existing {} + oo::copy Cls {} ::existing +} -returnCodes error -cleanup { + Super destroy + catch {namespace delete ::existing} +} -result {::existing refers to an existing namespace} +test oo-15.13 {OO: object cloning with target NS} -setup { + oo::class create Super + oo::class create Cls {superclass Super} +} -body { + list [namespace exist ::dupens] [oo::copy Cls Cls2 ::dupens] [namespace exist ::dupens] +} -cleanup { + Super destroy +} -result {0 ::Cls2 1} +test oo-15.14 {OO: object cloning with target NS} -setup { + oo::class create Cls {export eval} + set result {} +} -body { + Cls create obj + obj eval { + proc test-15.14 {} {} + } + lappend result [info commands ::dupens::t*] + oo::copy obj obj2 ::dupens + lappend result [info commands ::dupens::t*] +} -cleanup { + Cls destroy +} -result {{} ::dupens::test-15.14} test oo-16.1 {OO: object introspection} -body { info object |