TestAsserter.st
changeset 721 c11e3a43a1b4
parent 718 b37f66696d9b
child 729 5df0b62db3d7
equal deleted inserted replaced
719:2c96860ad5cb 721:c11e3a43a1b4
    15 !
    15 !
    16 
    16 
    17 
    17 
    18 !TestAsserter class methodsFor:'asserting'!
    18 !TestAsserter class methodsFor:'asserting'!
    19 
    19 
    20 assert: aBoolean description: aString
    20 assert: aBooleanOrBlock description: aString
    21         "Minimal clone of the instance-side assert protocol so that class-side methods can use it."
    21         "Minimal clone of the instance-side assert protocol so that class-side methods can use it."
    22 
    22 
    23         aBoolean ifFalse: [
    23         aBooleanOrBlock value ifFalse: [
    24             self logFailure: aString.
    24             self logFailure: aString.
    25             TestResult failure sunitSignalWith: aString
    25             TestResult failure sunitSignalWith: aString
    26         ].
    26         ].
    27 
    27 
    28     "Modified (format): / 13-07-2017 / 15:03:51 / cg"
    28     "Modified (format): / 13-07-2017 / 15:03:51 / cg"
       
    29     "Modified: / 26-08-2018 / 18:06:18 / Claus Gittinger"
    29 ! !
    30 ! !
    30 
    31 
    31 !TestAsserter class methodsFor:'logging'!
    32 !TestAsserter class methodsFor:'logging'!
    32 
    33 
    33 failureLog
    34 failureLog
   361         description: [ anObject printString, ' is not equal to ', anotherObject printString ].
   362         description: [ anObject printString, ' is not equal to ', anotherObject printString ].
   362 
   363 
   363     "Modified: / 13-07-2017 / 15:12:26 / cg"
   364     "Modified: / 13-07-2017 / 15:12:26 / cg"
   364 !
   365 !
   365 
   366 
       
   367 assert:anObject isAtLeast:anotherObject
       
   368     ^ self 
       
   369         assert: anObject >= anotherObject
       
   370         description: [ anObject printString, ' is less than ', anotherObject printString ].
       
   371 
       
   372     "Created: / 26-08-2018 / 18:01:14 / Claus Gittinger"
       
   373 !
       
   374 
   366 assertCollection:actual equals:expected
   375 assertCollection:actual equals:expected
   367     "specialized test method that generates a proper error message for collection"
   376     "specialized test method that generates a proper error message for collection"
   368 
   377 
   369     ^ self 
   378     ^ self 
   370         assert:(expected = actual)
   379         assert:(expected = actual)