::xox::test
Class TestObject

Heritage:
::xotcl::Object
  |
  +--::xox::Node
        |
        +--::xounit::Test
              |
              +--::xounit::Assert
                    |
                    +--::xounit::TestCase
Tested Class:
::xox::Object

Class TestObject
superclass ::xounit::TestCase,

Variables
NameDefault ValueClassComment
currentTestMethod    ::xounit::TestCase
 name of the currently running test method.
nodeName    ::xox::Node
 
result    ::xounit::TestCase
 the result for the current run.
 
Methods
NameComment
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

testClassComment

Description:
 
Code:
  ::xox::test::TestObject instproc testClassComment {}  {
   

        set o [ Class new ]

        $o # $o {NewClass Comment}

        my assertEquals [ $o get# $o ] "NewClass Comment"
    
}

testComment

Description:
 
Code:
  ::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"
    
}

testComment2

Description:
 
Code:
  ::xox::test::TestObject instproc testComment2 {}  {
   

        set o [ Object new ]

        $o # someProc Doc

        $o proc someProc {} {

        }

        my assertEquals [ $o get# someProc ]  "Doc"
    
}

testDot

Description:
 
Code:
  ::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
    
}

testDotExecute

Description:
 
Code:
  ::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}
    
}

testDotExecuteSecondLevel

Description:
 
Code:
  ::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}
    
}

testDotNoValue

Description:
 
Code:
  ::xox::test::TestObject instproc testDotNoValue {}  {
   

        set o [ Object new ]

        $o parametercmd v

        catch {
            $o . v

            puts "Failed TestObject::testDotNotParam"
            exit 
        }
    
}

testDotNotParam

Description:
 
Code:
  ::xox::test::TestObject instproc testDotNotParam {}  {
   

        set o [ Object new ]

        catch {
            $o . v

            puts "Failed TestObject::testDotNotParam"
            exit 
        }
    
}

testDotSecondLevel

Description:
 
Code:
  ::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
    
}

testDotSubstitution

Description:
 
Code:
  ::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
    
}

testGarbageCollect

Description:
 
Code:
  ::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
        }
    
}

testGarbageCollectClass

Description:
 
Code:
  ::xox::test::TestObject instproc testGarbageCollectClass {}  {
   

        ::xotcl::Class ::xox::test::GBTest

        my assertObject ::xox::test::GBTest

        ::xox::test::GBTest garbageCollect        

        my assertObject ::xox::test::GBTest
    
}

testHelp

Description:
 
Code:
  ::xox::test::TestObject instproc testHelp {}  {
   

        set o [ Object new ]

        $o ?
        $o ? set
    
}

testHelpMethods

Description:
 
Code:
  ::xox::test::TestObject instproc testHelpMethods {}  {
   
       
        set o [ Object new ]

        $o ?methods
    
}

testIntrospectionWithComment

Description:
 
Code:
  ::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"
        }
    
}

testLongComment

Description:
 
Code:
  ::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"

    
}

testParameter

Description:
 
Code:
  ::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
    
}

testSetParameterDefaults

Description:
 
Code:
  ::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
    
}

testSetParameterDefaultsPrecedence

Description:
 
Code:
  ::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
    
}