|
||||||
| SUMMARY: CHILDREN | PARAMETER | INSTPROC | INSTFILTER | INSTFORWARD | DETAIL: | INSTPROC | |||||
::xotcl::Object
|
+--::xox::Node
|
+--::xounit::Test
|
+--::xounit::Assert
|
+--::xounit::TestCase
| Variables | |||
| Name | Default Value | Class | Comment |
currentTestMethod |
::xounit::TestCase | name of the currently running test method. |
|
nodeName |
::xox::Node | ||
result |
::xounit::TestCase | the result for the current run. |
|
| Methods | |
| Name | Comment |
testClassComment {}
| |
testComment {}
| |
testComment2 {}
| |
testDot {}
| |
testDotExecute {}
| |
testDotExecuteSecondLevel {}
| |
testDotNoValue {}
| |
testDotNotParam {}
| |
testDotSecondLevel {}
| |
testDotSubstitution {}
| |
testGarbageCollect {}
| |
testGarbageCollectClass {}
| |
testHelp {}
| |
testHelpMethods {}
| |
testIntrospectionWithComment {}
| |
testLongComment {}
| |
testParameter {}
| |
testSetParameterDefaults {}
| |
testSetParameterDefaultsPrecedence {}
| |
| Methods from ::xotcl::Object |
#, ., ?, ?code, ?methods, ?object, abstract, copy, coverageFilter, defaultmethod, extractConfigureArg, filterappend, garbageCollect, get#, getClean#, hasclass, init, methodTag, mixinappend, move, profileFilter, self, setParameterDefaults, shell, tclcmd, traceFilter,
|
| Instproc Detail |
::xox::test::TestObject instproc testClassComment {} {
set o [ Class new ]
$o # $o {NewClass Comment}
my assertEquals [ $o get# $o ] "NewClass Comment"
}
::xox::test::TestObject instproc testComment {} {
set o [ Object new ]
my assertEquals [ $o # p {a proc} ] "a proc"
my assertEquals [ $o get# p ] "a proc"
$o # p {more}
my assertEquals [ $o get# p ] "a proc\nmore"
}
::xox::test::TestObject instproc testComment2 {} {
set o [ Object new ]
$o # someProc Doc
$o proc someProc {} {
}
my assertEquals [ $o get# someProc ] "Doc"
}
::xox::test::TestObject instproc testDot {} {
set o [ Object new ]
$o parametercmd v
$o v 5
my assertEquals [ $o v ] 5
my assertEquals [ $o . v ] 5
}
::xox::test::TestObject instproc testDotExecute {} {
set o [ Object new ]
set c [ Object new ]
$o parametercmd c
$c parametercmd v
$o c $c
$c proc test { args } {
return $args
}
my assertEquals [ [ $o c ] test 1 2 3 ] {1 2 3}
my assertEquals [ $o . c . test 1 2 3 ] {1 2 3}
}
::xox::test::TestObject instproc testDotExecuteSecondLevel {} {
set o [ Object new ]
set t [ Object new ]
set h [ Object new ]
$o parametercmd c
$t parametercmd c
$o c $t
$t c $h
$h proc test { args } {
return $args
}
my assertEquals [ [ [ $o c ] c ] test 1 2 3 ] {1 2 3}
my assertEquals [ $o . c . c . test 1 2 3 ] {1 2 3}
}
::xox::test::TestObject instproc testDotNoValue {} {
set o [ Object new ]
$o parametercmd v
catch {
$o . v
puts "Failed TestObject::testDotNotParam"
exit
}
}
::xox::test::TestObject instproc testDotNotParam {} {
set o [ Object new ]
catch {
$o . v
puts "Failed TestObject::testDotNotParam"
exit
}
}
::xox::test::TestObject instproc testDotSecondLevel {} {
set o [ Object new ]
set c [ Object new ]
$o parametercmd c
$c parametercmd v
$o c $c
$c v 5
my assertEquals [ [ $o c ] v ] 5
my assertEquals [ $o . c . v ] 5
}
::xox::test::TestObject instproc testDotSubstitution {} {
set o [ Object new ]
set c [ Object new ]
$o parametercmd c
$c parametercmd v
$o c $c
$c v 5
set x c
set y v
my assertEquals [ [ $o $x ] $y ] 5
my assertEquals [ $o . $x . $y ] 5
}
::xox::test::TestObject instproc testGarbageCollect {} {
set o [ ::xotcl::Object new ]
my assertObject $o
$o destroy
my assertFailure {
my assertObject $o
}
set o [ ::xotcl::Object new ]
my assertObject $o
$o garbageCollect
my assertFailure {
my assertObject $o
}
}
::xox::test::TestObject instproc testGarbageCollectClass {} {
::xotcl::Class ::xox::test::GBTest
my assertObject ::xox::test::GBTest
::xox::test::GBTest garbageCollect
my assertObject ::xox::test::GBTest
}
::xox::test::TestObject instproc testHelp {} {
set o [ Object new ]
$o ?
$o ? set
}
::xox::test::TestObject instproc testHelpMethods {} {
set o [ Object new ]
$o ?methods
}
::xox::test::TestObject instproc testIntrospectionWithComment {} {
set o [ Object new ]
$o # someProc someProc
$o proc someProc {} {
}
$o # anotherProc anotherProc
$o proc anotherProc {} {
}
my assertEquals [ lsort [ $o info procs ] ] "anotherProc someProc"
foreach proc [ $o info procs ] {
my assertEquals [ $o get# $proc ] "$proc"
}
}
::xox::test::TestObject instproc testLongComment {} {
set o [ Object new ]
$o # noProc {This is a really long comment}
my assertEquals [ $o get# noProc ] "This is a really long comment"
}
::xox::test::TestObject instproc testParameter {} {
set o [ Object new ]
$o parametercmd v
my assertNotEquals [ lsearch [ $o info methods ] v ] -1
my assertEquals [ lsearch [ $o info vars ] v ] -1
$o v 5
my assertNotEquals [ lsearch [ $o info vars ] v ] -1
my assertEquals [ $o v ] 5
}
::xox::test::TestObject instproc testSetParameterDefaults {} {
Class ::xox::test::TestSPD
::xox::test::TestSPD parameter {
{ x 1 }
}
set o [ Object new ]
$o class ::xox::test::TestSPD
my assertFalse [ $o exists x ]
$o setParameterDefaults
my assert [ $o exists x ]
my assertEquals [ $o x ] 1
$o class Object
$o setParameterDefaults
}
::xox::test::TestObject instproc testSetParameterDefaultsPrecedence {} {
Class ::xox::test::TestSPDSuperClass
Class ::xox::test::TestSPD2 -superclass ::xox::test::TestSPDSuperClass
::xox::test::TestSPDSuperClass parameter {
{ y 1 }
{ x 2 }
}
::xox::test::TestSPD2 parameter {
{ x 1 }
}
set o [ Object new ]
$o class ::xox::test::TestSPD2
my assertFalse [ $o exists x ] 1
$o setParameterDefaults
my assert [ $o exists x ] 2
my assertEquals [ $o x ] 1 3
my assert [ $o exists y ] 4
my assertEquals [ $o y ] 1 5
$o class Object
$o setParameterDefaults
}