::xounit::test
Class TestAssert

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

Class TestAssert
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
testAssert0 {}  
testAssert1 {}  
testAssertDoNotFindIn {}  
testAssertError {}  
testAssertErrorFail {}  
testAssertExists {}  
testAssertExists2 {}  
testAssertExistsObject {}  
testAssertExistsValue {}  
testAssertFindIn {}  
testAssertInteger {}  
testAssertIntegerInRange {}  
testAssertNoErrorFail {}  
testAssertObject {}  
testAssertObjectInList {}  
testAssertValueInList {}  
testNoFailure {}  
testRegexFail {}  
testRegexPositive {}  
   
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

testAssert0

Description:
 
Code:
  ::xounit::test::TestAssert instproc testAssert0 {}  {
   

        my assertFailure { my assert 0 {Passed} }
    
}

testAssert1

Description:
 
Code:
  ::xounit::test::TestAssert instproc testAssert1 {}  {
   

        my assert 1 {Test true}
    
}

testAssertDoNotFindIn

Description:
 
Code:
  ::xounit::test::TestAssert instproc testAssertDoNotFindIn {}  {
   

        my assertDoNotFindIn a b
        my assertFailure { my assertDoNotFindIn a a }
    
}

testAssertError

Description:
 
Code:
  ::xounit::test::TestAssert instproc testAssertError {}  {
   

        my assertNoError { set a 1 } "A"
        my assertError { error a } "B"
    
}

testAssertErrorFail

Description:
 
Code:
  ::xounit::test::TestAssert instproc testAssertErrorFail {}  {
   

        my assertFailure {

        my assertError { set a Passed } "Passed"

        }
    
}

testAssertExists

Description:
 
Code:
  ::xounit::test::TestAssert instproc testAssertExists {}  {
   

       my assertFailure { my assertExists someVariable }
       my assertNotExists someVariable
       my set someVariable someValue
       my assertExists someVariable 
       my assertFailure { my assertNotExists someVariable }
    
}

testAssertExists2

Description:
 
Code:
  ::xounit::test::TestAssert instproc testAssertExists2 {}  {
   

       set a [ ::xounit::Assert new ]

       my assertFailure { $a assertExists someVariable }
       $a assertNotExists someVariable
       $a set someVariable someValue
       $a assertExists someVariable 
       my assertFailure { $a assertNotExists someVariable }
    
}

testAssertExistsObject

Description:
 
Code:
  ::xounit::test::TestAssert instproc testAssertExistsObject {}  {
   

        set a [ ::xounit::Assert new ]

        $a set a 5
        $a set o [ Object new ]

        my assertFailure { $a assertExistsObject a }
        my assertFailure { $a assertExistsObject b }
        $a assertExistsObject o
    
}

testAssertExistsValue

Description:
 
Code:
  ::xounit::test::TestAssert instproc testAssertExistsValue {}  {
   

       set a [ ::xounit::Assert new ]

       my assertFailure { $a assertExistsValue someVariable }
       $a set someVariable ""
       my assertFailure { $a assertExistsValue someVariable }
       $a set someVariable someValue
       $a assertExistsValue someVariable 
    
}

testAssertFindIn

Description:
 
Code:
  ::xounit::test::TestAssert instproc testAssertFindIn {}  {
   

        set a [ ::xounit::Assert new ]

        $a assertFindIn a a "Should find a"
        $a assertFindIn a abcdefgh "Should find a"
        $a assertFindIn a "
        
        abcdefgh" "Should find a"

        $a assertFindIn TestCasesAreCool "I dont know about you but I think TestCasesAreCool" 

        my assertFailure { $a assertFindIn b a }

        my assertFailure { $a assertFindIn "" a }
    
}

testAssertInteger

Description:
 
Code:
  ::xounit::test::TestAssert instproc testAssertInteger {}  {
   

        my assertInteger 0
        my assertInteger -100
        my assertInteger 100

        my assertFailure { my assertInteger A }
        my assertFailure { my assertInteger "" }
        my assertFailure { my assertInteger [ Object new ] }
    
}

testAssertIntegerInRange

Description:
 
Code:
  ::xounit::test::TestAssert instproc testAssertIntegerInRange {}  {
   

        my assertIntegerInRange 0 0 1
        my assertIntegerInRange -100 -1000 0
        my assertIntegerInRange 100 0 1000 

        my assertFailure { my assertIntegerInRange A 0 100 }
        my assertFailure { my assertIntegerInRange "" 0 100 }
        my assertFailure { my assertIntegerInRange [ Object new ] 0 100 }
        my assertFailure { my assertIntegerInRange -1 0 100 }
        my assertFailure { my assertIntegerInRange 101 0 100 }
    
}

testAssertNoErrorFail

Description:
 
Code:
  ::xounit::test::TestAssert instproc testAssertNoErrorFail {}  {
   

        my assertFailure {

        my assertNoError { error Passed } "Passed"

        }
    
}

testAssertObject

Description:
 
Code:
  ::xounit::test::TestAssert instproc testAssertObject {}  {
   

        my assertObject [ Object new ] 
        set old [ Object new ]
        $old destroy
        my assertFailure { my assertObject $old }
    
}

testAssertObjectInList

Description:
 
Code:
  ::xounit::test::TestAssert instproc testAssertObjectInList {}  {
   

        set objects ""

        set o1 [ ::xotcl::Object new ]
        set o2 [ ::xotcl::Object new ]

        my assertFailure { my assertObjectInList $objects $o1 }
        my assertFailure { my assertObjectInList $objects $o2 }

        set objects [ list $o1 $o2 ]

        my assertObjectInList $objects $o1
        my assertObjectInList $objects $o2

        set objects [ list $o1 ]

        my assertObjectInList $objects $o1
        my assertFailure { my assertObjectInList $objects $o2 }

        set objects [ list $o2 ]

        my assertObjectInList $objects $o2
        my assertFailure { my assertObjectInList $objects $o1 }
    
}

testAssertValueInList

Description:
 
Code:
  ::xounit::test::TestAssert instproc testAssertValueInList {}  {
   

        set list ""

        my assertFailure { my assertValueInList $list A }
        my assertFailure { my assertValueInList $list B }

        set list [ list A B ]

        my assertValueInList $list A
        my assertValueInList $list B

        set list [ list A ]

        my assertValueInList $list A
        my assertFailure { my assertValueInList $list B }

        set list [ list B ]

        my assertValueInList $list B
        my assertFailure { my assertValueInList $list A }
    
}

testNoFailure

Description:
 
Code:
  ::xounit::test::TestAssert instproc testNoFailure {}  {
   

        my assertNoFailure { }
        my assertFailure { my assertNoFailure { my fail ack } }
    
}

testRegexFail

Description:
 
Code:
  ::xounit::test::TestAssert instproc testRegexFail {}  {
   

        set a [ ::xounit::Assert new ]

        catch {

        $a assertRegex a b

            my catchAndReport {

                my fail "\$a assertRegex a b should have failed"
            }
        }
    
}

testRegexPositive

Description:
 
Code:
  ::xounit::test::TestAssert instproc testRegexPositive {}  {
   

        set a [ ::xounit::Assert new ]

        $a assertRegex a a

        $a assertRegex . a

        set all [ $a assertRegex (!+) !!!!. ]

        my assertEquals !!!! $all 
    
}