|
||||||
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 |
notestRemoveNode {}
| |
testAddNode {}
| |
testAutoName {}
| |
testAutoNaming {}
| |
testChildFactory {}
| |
testChildFactoryArgs {}
| |
testChildFactoryFail {}
| |
testChildNameWithSpace {}
| |
testCreateAutoNamedChild {}
| |
testCreateChildOf {}
| |
testCreateNamespace {}
| |
testGetAllSubNodes {}
| |
testGetNode {}
| |
testGetNode2 {}
| |
testHasNode {}
| |
testMove1 {}
| |
testMove2 {}
| |
testMove3 {}
| |
testMove4 {}
| |
testName {}
| |
testName2 {}
| |
testNewChildOf {}
| |
testNewNamespace {}
| |
testNextName {}
| |
testPath {}
| |
testSlash {}
| |
testSlashLevels {}
| |
testSubNodes {}
| |
testXOTclCompatibleChildren {}
|
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::TestNode instproc notestRemoveNode {} { set fe [ ::xox::Node new ] set sfe0 [ ::xox::Node new ] set sfe1 [ ::xox::Node new ] $fe addNode $sfe0 $fe / Node $fe getNode Node my assert [ $sfe0 exists parentNode ] "No parent element" my assertEquals [ $sfe0 parentNode ] $fe 2 my assertEquals [ $fe / Node ] $sfe0 3 $fe removeNode $sfe0 my assertFalse [ $sfe0 exists parentNode ] 4 ::xoexception::try { my assertEquals [ $fe / Node ] "" 5 } catch { onlyerror result } { } }
::xox::test::TestNode instproc testAddNode {} { set fe [ ::xox::Node new -nodeName Node0 ] set sfe0 [ ::xox::Node new -nodeName Node1 ] set sfe1 [ ::xox::Node new -nodeName Node2 ] set sfe2 [ ::xox::Node new -nodeName Node3 ] my assertEquals [ $fe getNodeName ] Node0 my assertEquals [ $sfe0 getNodeName ] Node1 my assertEquals [ $sfe1 getNodeName ] Node2 my assertEquals [ $sfe2 getNodeName ] Node3 set sfe0 [ $fe addNode $sfe0 ] set sfe1 [ $fe addNode $sfe1 ] set sfe2 [ $fe addNode $sfe2 ] my assertEquals [ $fe getNodeName ] Node0 my assertEquals [ $sfe0 getNodeName ] Node1 my assertEquals [ $sfe1 getNodeName ] Node2 my assertEquals [ $sfe2 getNodeName ] Node3 $fe / Node1 $fe / Node2 $fe / Node3 my assertEquals [ $fe getNode Node1 ] $sfe0 my assertEquals [ $fe getNode Node2 ] $sfe1 my assertEquals [ $fe getNode Node3 ] $sfe2 }
::xox::test::TestNode instproc testAutoName {} { set o [ Object new ] my assertEquals [ $o autoname a ] a1 my assertEquals [ $o autoname a ] a2 my assertEquals [ $o autoname a ] a3 my assertEquals [ $o autoname a ] a4 }
::xox::test::TestNode instproc testAutoNaming {} { set fe [ ::xox::Node new -nodeName Node ] set sfe0 [ ::xox::Node new -nodeName Node ] set sfe1 [ ::xox::Node new -nodeName Node ] set sfe2 [ ::xox::Node new -nodeName Node ] my assertEquals [ $fe getNodeName ] Node my assertEquals [ $sfe0 getNodeName ] Node my assertEquals [ $sfe1 getNodeName ] Node my assertEquals [ $sfe2 getNodeName ] Node set sfe0 [ $fe addAutoNameNode $sfe0 ] set sfe1 [ $fe addAutoNameNode $sfe1 ] set sfe2 [ $fe addAutoNameNode $sfe2 ] my assertEquals [ $fe getNodeName ] Node my assertEquals [ $sfe0 getNodeName ] Node my assertEquals [ $sfe1 getNodeName ] Node_0 my assertEquals [ $sfe2 getNodeName ] Node_1 $fe / Node $fe / Node_0 $fe / Node_1 my assertEquals $sfe0 [ $fe getNode Node ] my assertEquals $sfe1 [ $fe getNode Node_0 ] my assertEquals $sfe2 [ $fe getNode Node_1 ] }
::xox::test::TestNode instproc testChildFactory {} { set parent [ ::xox::Node new ] set child [ $parent createChild child ::xox::Node ] my assertObject $child my assertEquals [ $child info class ] ::xox::Node my assertEquals $child ${parent}::child my assertEquals [ $child getNodeName ] child $parent / child }
::xox::test::TestNode instproc testChildFactoryArgs {} { set parent [ ::xox::Node new ] set child [ $parent createChild child ::xox::Node -set a 5 -set b 6 ] my assertObject $child my assertEquals [ $child info class ] ::xox::Node my assertEquals $child ${parent}::child my assertEquals [ $child getNodeName ] child my assertEquals [ $child set a ] 5 my assertEquals [ $child set b ] 6 }
::xox::test::TestNode instproc testChildFactoryFail {} { set parent [ ::xox::Node new ] set child [ $parent createChild child ::xox::Node ] my assertError { $parent createChild child } }
::xox::test::TestNode instproc testChildNameWithSpace {} { set parent [ ::xox::Node new ] set child [ $parent createChild "start end" ::xox::Node ] my assertEquals $child "${parent}::start_end" }
::xox::test::TestNode instproc testCreateAutoNamedChild {} { Class ::xox::test::XXXTestAutoName -superclass ::xox::Node set root [ ::xox::Node new ] set child [ $root createAutoNamedChild ::xox::test::XXXTestAutoName ] my assertEquals $child ${root}::XXXTestAutoName $root / XXXTestAutoName set child [ $root createAutoNamedChild ::xox::test::XXXTestAutoName ] my assertEquals $child ${root}::XXXTestAutoName1 $root / XXXTestAutoName1 set child [ $root createAutoNamedChild ::xox::test::XXXTestAutoName ] my assertEquals $child ${root}::XXXTestAutoName2 $root / XXXTestAutoName2 set root2 [ ::xox::Node new ] set child [ $root2 createAutoNamedChild ::xox::test::XXXTestAutoName ] my assertEquals $child ${root2}::XXXTestAutoName $root2 / XXXTestAutoName set child [ $root2 createAutoNamedChild ::xox::test::XXXTestAutoName ] my assertEquals $child ${root2}::XXXTestAutoName1 $root2 / XXXTestAutoName1 set child [ $root2 createAutoNamedChild ::xox::test::XXXTestAutoName ] my assertEquals $child ${root2}::XXXTestAutoName2 $root2 / XXXTestAutoName2 }
::xox::test::TestNode instproc testCreateChildOf {} { set parent [ ::xox::Node new ] set child [ ::xox::Node create ${parent}::a ] set newChild [ $parent info children ] my assertObject $newChild }
::xox::test::TestNode instproc testCreateNamespace {} { set root [ ::xox::Node create ::testNode ] my assertEquals $root ::testNode 1 set ::testNode::a 1 my assertEquals [ $root set a ] 1 my assertEquals [ subst $${root}::a ] 1 my assertEquals [ set ${root}::a ] 1 my assertEquals $::testNode::a 1 ::testNode destroy }
::xox::test::TestNode instproc testGetAllSubNodes {} { set root [ ::xox::Node new ] set sub [ ::xox::Node new ] set subsub [ ::xox::Node new ] $root getAllSubNodes }
::xox::test::TestNode instproc testGetNode {} { set fe [ ::xox::Node new ] set sub [ ::xox::Node new ] set sub [ $fe addNode $sub ] my assert [ $fe hasNode Node ] $fe / Node my assertEquals $sub [ $fe getNode Node ] }
::xox::test::TestNode instproc testGetNode2 {} { set fe [ ::xox::Node new ] set sub [ ::xox::Node new ] set sub [ $fe addNode $sub ] my assert [ $fe hasNode Node ] $fe / Node my assertEquals $sub [ $fe getNode Node ] }
::xox::test::TestNode instproc testHasNode {} { set fe [ ::xox::Node new ] $fe addNode [ ::xox::Node new ] my assert [ $fe hasNode Node ] $fe / Node }
::xox::test::TestNode instproc testMove1 {} { set root [ ::xox::Node create ::testNode ] set child [ ::xox::Node new ] my assertEquals [ $root info children ] "" $child move ::testNode::subNode my assertFalse [ Object isobject $child ] set child ::testNode::subNode my assertObject $child my assertEquals [ $root info children ] $child my assertEquals $root ::testNode my assertEquals $child ::testNode::subNode set ::testNode::subNode::a 1 my assertEquals [ $child set a ] 1 my assertEquals [ set ${root}::subNode::a ] 1 my assertEquals [ set ${child}::a ] 1 }
::xox::test::TestNode instproc testMove2 {} { #Move will not work for using xotcl composition because #the object reference is changed. #The only option left is to create the objects under a parent. set parent [ ::xox::Node new ] set child [ ::xox::Node new ] my assertObject $parent my assertObject $child $child move ${parent}::child my assertObject $parent #Old object reference is useless, perhaps this old reference could #be a proxy object, a reference object. Thats too complex. my assertFailure { my assertObject $child } set newChild [ $parent info children ] my assertObject $newChild }
::xox::test::TestNode instproc testMove3 {} { catch { ::xox::test::a destroy } catch { ::xox::test::b destroy } #Rethinking the xotcl move set node [ ::xox::Node create ::xox::test::a ] set newNode ::xox::test::b $node set a 5 my assertObject $node my assertFailure { my assertObject $newNode } my assertEquals [ $node set a ] 5 $node move $newNode my assertFailure { my assertObject $node } my assertObject $newNode my assertEquals [ $newNode set a ] 5 }
::xox::test::TestNode instproc testMove4 {} { catch { ::xox::test::a destroy } catch { ::xox::test::b destroy } #Rethinking the xotcl move set node [ ::xox::Node create ::xox::test::a ] ::xox::Node create ::xox::test::a::sub set newNode ::xox::test::b $node set a 5 my assertObject $node my assertFailure { my assertObject $newNode } my assertEquals [ $node set a ] 5 $node move $newNode my assertFailure { my assertObject $node } my assertFailure { my assertObject ${node}::sub } my assertObject $newNode my assertEquals [ $newNode set a ] 5 my assertObject ${newNode}::sub }
::xox::test::TestNode instproc testName {} { set fe [ ::xox::Node new ] my assertEquals [ $fe getNodeName ] Node my assertFalse [ $fe exists name ] my assertError { $fe name } }
::xox::test::TestNode instproc testName2 {} { set root [ ::xox::Node new ] my assertError { $root name } 1 set sub [ $root addNode [ ::xox::Node new ] ] set sub [ $sub addNode [ ::xox::Node new ] ] set sub [ $sub addNode [ ::xox::Node new ] ] set sub [ $sub addNode [ ::xox::Node new ] ] set sub [ $sub addNode [ ::xox::Node new ] ] my assertError { $sub name } 2 set subRoot [ $root findRoot ] my assertError { $subRoot name } 3 my assertEquals $root $subRoot 4 set subRoot [ $sub findRoot ] my assertEquals $root $subRoot 5 }
::xox::test::TestNode instproc testNewChildOf {} { set parent [ ::xox::Node new ] set child [ ::xox::Node new -childof $parent ] set newChild [ $parent info children ] my assertObject $newChild }
::xox::test::TestNode instproc testNewNamespace {} { set root [ ::xox::Node new ] set ${root}::a 1 my assertEquals [ $root set a ] 1 my assertError { my assertEquals [ subst $${root}::a ] 1 } "This seems to not be valid" my assertEquals [ set ${root}::a ] 1 }
::xox::test::TestNode instproc testNextName {} { set fe [ ::xox::Node new -nodeName Node ] set sfe0 [ ::xox::Node new -nodeName Node ] set sfe1 [ ::xox::Node new -nodeName Node_0 ] set number [ ::xox::Node new -nodeName Node9 ] set sfe0 [ $fe addNode $sfe0 ] my assertEquals [ $fe getNodeName ] Node 1 my assertEquals [ $sfe0 getNodeName ] Node 2 my assertEquals [ $sfe1 getNodeName ] Node_0 3 my assertEquals [ $number getNodeName ] Node9 4 my assertError { $fe name } my assertError { $sfe0 name } my assertError { $sfe1 name } my assertError { $number name } my assertEquals [ $fe nextName Node ] "Node_0" set sfe1 [ $fe addNode $sfe1 ] my assertEquals [ $fe nextName Node ] "Node_1" set number [ $fe addNode $number ] my assertEquals [ $fe nextName Node9 ] "Node9_0" }
::xox::test::TestNode instproc testPath {} { set root [ ::xox::Node new ] set sub [ ::xox::Node new ] set subsub [ ::xox::Node new ] set sub [ $root addNode $sub ] set subsub [ $sub addNode $subsub ] my assertEquals [ $root path ] "Node" my assertEquals [ $sub path ] "Node / Node" my assertEquals [ $subsub path ] "Node / Node / Node" }
::xox::test::TestNode instproc testSlash {} { set fe [ ::xox::Node new -nodeName Node0 ] set sfe0 [ ::xox::Node new -nodeName Node1 ] set sfe1 [ ::xox::Node new -nodeName Node2 ] set sfe2 [ ::xox::Node new -nodeName Node3 ] set sfe3 [ ::xox::Node new -nodeName Node4 ] set sfe0 [ $fe addNode $sfe0 ] set sfe1 [ $fe addNode $sfe1 ] set sfe2 [ $fe addNode $sfe2 ] set sfe3 [ $fe addNode $sfe3 ] my assertEquals [ $fe / Node1 ] $sfe0 my assertEquals [ $fe / Node2 ] $sfe1 my assertEquals [ $fe / Node3 ] $sfe2 my assertEquals [ $fe / Node4 ] $sfe3 }
::xox::test::TestNode instproc testSlashLevels {} { set fe [ ::xox::Node new ] set sfe0 [ ::xox::Node new ] set sfe1 [ ::xox::Node new ] set sfe2 [ ::xox::Node new ] set sfe3 [ ::xox::Node new ] set sfe0 [ $fe addNode $sfe0 ] set sfe1 [ $sfe0 addNode $sfe1 ] set sfe2 [ $sfe1 addNode $sfe2 ] set sfe3 [ $sfe2 addNode $sfe3 ] my assertEquals [ $fe / Node ] $sfe0 1 my assertEquals [ $fe / Node / Node ] $sfe1 2 my assertEquals [ $fe / Node / Node / Node] $sfe2 3 my assertEquals [ $fe / Node / Node / Node / Node ] $sfe3 4 }
::xox::test::TestNode instproc testSubNodes {} { set root [ ::xox::Node create ::testNode ] set child [ ::xox::Node create ::testNode::subNode ] my assertEquals $root ::testNode my assertEquals $child ::testNode::subNode my assertEquals [ $root info children ] $child set ::testNode::subNode::a 1 my assertEquals [ $child set a ] 1 my assertEquals [ set ${root}::subNode::a ] 1 my assertEquals [ set ${child}::a ] 1 }
::xox::test::TestNode instproc testXOTclCompatibleChildren {} { set parent [ ::xox::Node new ] set child [ $parent createChild child ::xox::Node ] my assertObject $child my assertEquals [ $child info class ] ::xox::Node my assertEquals $child ${parent}::child my assertEquals [ $child getNodeName ] child $parent / child }