diff options
author | Miguel Sofer <miguel.sofer@gmail.com> | 2008-07-18 14:02:42 (GMT) |
---|---|---|
committer | Miguel Sofer <miguel.sofer@gmail.com> | 2008-07-18 14:02:42 (GMT) |
commit | a0226c67f814c3d4a641687615bf4171ea749088 (patch) | |
tree | 8ff1c0a43b7231f6a69f4d07a80fadaa6e15d7c8 | |
parent | 23a7258539e21badb897541271727a7669550378 (diff) | |
download | tcl-a0226c67f814c3d4a641687615bf4171ea749088.zip tcl-a0226c67f814c3d4a641687615bf4171ea749088.tar.gz tcl-a0226c67f814c3d4a641687615bf4171ea749088.tar.bz2 |
* tests/NRE.test: Added basic tests for deep TclOO calls
-rw-r--r-- | ChangeLog | 2 | ||||
-rw-r--r-- | tests/NRE.test | 90 |
2 files changed, 91 insertions, 1 deletions
@@ -1,5 +1,7 @@ 2008-07-18 Miguel Sofer <msofer@users.sf.net> + * tests/NRE.test: Added basic tests for deep TclOO calls + * generic/tcl.decls: Change the public api prefix from * generic/tcl.h: TclNR_foo to Tcl_NRfoo * generic/tclBasic.c: diff --git a/tests/NRE.test b/tests/NRE.test index a4007a2..fddfa32 100644 --- a/tests/NRE.test +++ b/tests/NRE.test @@ -8,7 +8,7 @@ # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id: NRE.test,v 1.2 2008/07/16 00:44:44 msofer Exp $ +# RCS: @(#) $Id: NRE.test,v 1.3 2008/07/18 14:02:43 msofer Exp $ if {[lsearch [namespace children] ::tcltest] == -1} { package require tcltest @@ -215,6 +215,94 @@ test NRE-6.2 {[uplevel] is not recursive} -setup { } -result {0 20001} # +# Basic TclOO tests +# + +test NRE-oo.1 {really deep calls in oo - direct} -setup { + oo::object create foo + oo::objdefine foo method bar i { + if {[incr i] > 20000} { + return $i + } + foo bar $i + } +} -body { + foo bar 0 +} -cleanup { + foo destroy +} -result 20001 + +test NRE-oo.2 {really deep calls in oo - call via [self]} -setup { + oo::object create foo + oo::objdefine foo method bar i { + if {[incr i] > 20000} { + return $i + } + [self] bar $i + } +} -body { + foo bar 0 +} -cleanup { + foo destroy +} -result 20001 + +test NRE-oo.3 {really deep calls in oo - private calls} -setup { + oo::object create foo + oo::objdefine foo method bar i { + if {[incr i] > 20000} { + return $i + } + my bar $i + } +} -body { + foo bar 0 +} -cleanup { + foo destroy +} -result 20001 + +test NRE-oo.4 {really deep calls in oo - overriding} -setup { + oo::class create foo { + method bar i { + if {[incr i] > 20000} { + return $i + } + my bar $i + } + } + oo::class create boo { + superclass foo + method bar i { + if {[incr i] > 20000} { + return $i + } + next $i + } + } +} -body { + [boo new] bar 0 +} -cleanup { + foo destroy +} -result 20001 + +test NRE-oo.5 {really deep calls in oo - forwards} -setup { + oo::object create foo + oo::objdefine foo { + method bar i { + if {[incr i] > 20000} { + return $i + } + my boo $i + } + forward boo ::foo bar + } +} -body { + foo bar 0 +} -cleanup { + foo destroy +} -result 20001 + + +# # NASTY BUG found by tcllib's interp package # |