summaryrefslogtreecommitdiffstats
path: root/tests/oo.test
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2018-06-23 15:03:26 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2018-06-23 15:03:26 (GMT)
commit05209c57d377b14758bda3882b0a70b979898066 (patch)
tree2cbd3fa386325f56ebd8245d309463765202ef9c /tests/oo.test
parent8e696a5e5d19327336892388286b8d5d4fdc64a8 (diff)
downloadtcl-05209c57d377b14758bda3882b0a70b979898066.zip
tcl-05209c57d377b14758bda3882b0a70b979898066.tar.gz
tcl-05209c57d377b14758bda3882b0a70b979898066.tar.bz2
Make the delegates work by moving their creation into C.
Diffstat (limited to 'tests/oo.test')
-rw-r--r--tests/oo.test45
1 files changed, 44 insertions, 1 deletions
diff --git a/tests/oo.test b/tests/oo.test
index 25ef5e2..87f0567 100644
--- a/tests/oo.test
+++ b/tests/oo.test
@@ -340,7 +340,7 @@ test oo-1.21 {basic test of OO functionality: default relations} -setup {
lappend x [info object class ::oo::$initial]
}
return $x
- }] {lsort $x}
+ }] {lsort [lmap y $x {if {[string match *::delegate $y]} continue; set y}]}
} -cleanup {
interp delete $fresh
} -result {{} {::oo::Slot ::oo::abstract ::oo::class ::oo::object ::oo::singleton} {::oo::define::filter ::oo::define::mixin ::oo::define::superclass ::oo::define::variable ::oo::objdefine::filter ::oo::objdefine::mixin ::oo::objdefine::variable} {::oo::Slot ::oo::class} {::oo::abstract ::oo::singleton} {} {} {} {} {} ::oo::object ::oo::object ::oo::class ::oo::class ::oo::class}
@@ -4845,6 +4845,49 @@ test oo-40.3 {TIP 500: private and unexport} -setup {
} -cleanup {
cls destroy
} -result {{} {} foo {} foo {}}
+
+test oo-41.1 {TIP 478: classmethod} -setup {
+ oo::class create parent
+} -body {
+ oo::class create ActiveRecord {
+ superclass parent
+ classmethod find args { puts "[self] called with arguments: $args" }
+ }
+ oo::class create Table {
+ superclass ActiveRecord
+ }
+ Table find foo bar
+} -cleanup {
+ parent destroy
+} -output "::Table called with arguments: foo bar\n"
+test oo-41.2 {TIP 478: classmethod in namespace} -setup {
+ namespace eval ::testns {}
+} -body {
+ namespace eval ::testns {
+ oo::class create ActiveRecord {
+ classmethod find args { puts "[self] called with arguments: $args" }
+ }
+ oo::class create Table {
+ superclass ActiveRecord
+ }
+ }
+ testns::Table find foo bar
+} -cleanup {
+ namespace delete ::testns
+} -output "::testns::Table called with arguments: foo bar\n"
+test oo-41.3 {TIP 478: classmethod must not interfere with constructor signatures} -setup {
+ oo::class create parent
+} -body {
+ oo::class create TestClass {
+ superclass oo::class parent
+ self method create {name ignore body} {
+ next $name $body
+ }
+ }
+ TestClass create okay {} {}
+} -cleanup {
+ parent destroy
+} -result {::okay}
cleanupTests
return