diff options
author | dkf <donal.k.fellows@manchester.ac.uk> | 2018-10-20 23:41:32 (GMT) |
---|---|---|
committer | dkf <donal.k.fellows@manchester.ac.uk> | 2018-10-20 23:41:32 (GMT) |
commit | 9b417d4592f2b4b1640d0877d27345928e4210a7 (patch) | |
tree | 37d34c074b5e3c6a324ee8bd65a96e16c4b42b08 /tests/oo.test | |
parent | cb061edef8250a8cd969eb0eb291f4c44d65d74e (diff) | |
download | tcl-9b417d4592f2b4b1640d0877d27345928e4210a7.zip tcl-9b417d4592f2b4b1640d0877d27345928e4210a7.tar.gz tcl-9b417d4592f2b4b1640d0877d27345928e4210a7.tar.bz2 |
Rebase on 8.7
Diffstat (limited to 'tests/oo.test')
-rw-r--r-- | tests/oo.test | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/tests/oo.test b/tests/oo.test index 37c4495..4f5e65b 100644 --- a/tests/oo.test +++ b/tests/oo.test @@ -129,11 +129,11 @@ test oo-1.1 {basic test of OO functionality: no classes} { } {::foo {} a b c 3 {} {}} test oo-1.2 {basic test of OO functionality: no classes} -body { oo::define oo::object method missingArgs -} -returnCodes 1 -result "wrong # args: should be \"oo::define oo::object method name args body\"" +} -returnCodes 1 -result "wrong # args: should be \"oo::define oo::object method name ?option? args body\"" test oo-1.3 {basic test of OO functionality: no classes} { catch {oo::define oo::object method missingArgs} set errorInfo -} "wrong # args: should be \"oo::define oo::object method name args body\" +} "wrong # args: should be \"oo::define oo::object method name ?option? args body\" while executing \"oo::define oo::object method missingArgs\"" test oo-1.4 {basic test of OO functionality} -body { @@ -778,6 +778,22 @@ test oo-4.6 {export creates proper method entries} -setup { } -cleanup { testClass destroy } -result ok +test oo-4.7 {basic test of OO functionality: -export flag} { + set o [oo::object new] + set result {} + oo::objdefine $o method Foo {} {lappend ::result Foo; return} + lappend result [catch {$o Foo} msg] $msg + oo::objdefine $o method Bar -export {} {lappend ::result Bar; return} + lappend result [$o Bar] [$o destroy] +} {1 {unknown method "Foo": must be destroy} Bar {} {}} +test oo-4.8 {basic test of OO functionality: -unexport flag} { + set o [oo::object new] + set result {} + oo::objdefine $o method foo {} {lappend ::result foo; return} + lappend result [$o foo] + oo::objdefine $o method bar -unexport {} {lappend ::result bar; return} + lappend result [catch {$o bar} msg] $msg [$o destroy] +} {foo {} 1 {unknown method "bar": must be destroy or foo} {}} test oo-5.1 {OO: manipulation of classes as objects} -setup { set obj [oo::object new] |