extensions.st
author Claus Gittinger <cg@exept.de>
Wed, 06 Jul 2011 16:26:11 +0200
changeset 244 938d1a1386d2
parent 236 037f084beb1b
child 302 37b0e011624d
permissions -rw-r--r--
moved back - got lost
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
236
037f084beb1b Move some methods to TestCase
Stefan Vogel <sv@exept.de>
parents: 222
diff changeset
     1
"{ Package: 'stx:goodies/sunit' }"!
220
c2030e11e775 sunit stuff moved
Claus Gittinger <cg@exept.de>
parents: 120
diff changeset
     2
c2030e11e775 sunit stuff moved
Claus Gittinger <cg@exept.de>
parents: 120
diff changeset
     3
!Behavior methodsFor:'Camp Smalltalk'!
c2030e11e775 sunit stuff moved
Claus Gittinger <cg@exept.de>
parents: 120
diff changeset
     4
c2030e11e775 sunit stuff moved
Claus Gittinger <cg@exept.de>
parents: 120
diff changeset
     5
sunitSelectors
222
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 220
diff changeset
     6
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 220
diff changeset
     7
    ^self selectors
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 220
diff changeset
     8
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 220
diff changeset
     9
    "Modified: / 11-09-2010 / 15:07:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 220
diff changeset
    10
! !
236
037f084beb1b Move some methods to TestCase
Stefan Vogel <sv@exept.de>
parents: 222
diff changeset
    11
222
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 220
diff changeset
    12
!Block methodsFor:'Camp Smalltalk'!
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 220
diff changeset
    13
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 220
diff changeset
    14
sunitEnsure: aBlock
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 220
diff changeset
    15
	
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 220
diff changeset
    16
	^self ensure: aBlock
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 220
diff changeset
    17
! !
236
037f084beb1b Move some methods to TestCase
Stefan Vogel <sv@exept.de>
parents: 222
diff changeset
    18
222
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 220
diff changeset
    19
!Block methodsFor:'Camp Smalltalk'!
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 220
diff changeset
    20
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 220
diff changeset
    21
sunitOn: aSignal do: anExceptionBlock
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 220
diff changeset
    22
	
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 220
diff changeset
    23
	^self on: aSignal do: anExceptionBlock
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 220
diff changeset
    24
! !
220
c2030e11e775 sunit stuff moved
Claus Gittinger <cg@exept.de>
parents: 120
diff changeset
    25
244
938d1a1386d2 moved back - got lost
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
    26
!Class methodsFor:'Camp Smalltalk'!
938d1a1386d2 moved back - got lost
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
    27
938d1a1386d2 moved back - got lost
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
    28
sunitName
938d1a1386d2 moved back - got lost
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
    29
	
938d1a1386d2 moved back - got lost
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
    30
	^self name
938d1a1386d2 moved back - got lost
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
    31
! !
938d1a1386d2 moved back - got lost
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
    32
222
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 220
diff changeset
    33
!Exception methodsFor:'Camp Smalltalk'!
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 220
diff changeset
    34
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 220
diff changeset
    35
sunitAnnounce: aTestCase toResult: aTestResult
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 220
diff changeset
    36
	aTestResult addError: aTestCase.
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 220
diff changeset
    37
	self sunitExitWith: false.
220
c2030e11e775 sunit stuff moved
Claus Gittinger <cg@exept.de>
parents: 120
diff changeset
    38
! !
236
037f084beb1b Move some methods to TestCase
Stefan Vogel <sv@exept.de>
parents: 222
diff changeset
    39
222
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 220
diff changeset
    40
!Exception methodsFor:'Camp Smalltalk'!
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 220
diff changeset
    41
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 220
diff changeset
    42
sunitExitWith: aValue
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 220
diff changeset
    43
	
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 220
diff changeset
    44
	^self return: aValue
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 220
diff changeset
    45
! !
236
037f084beb1b Move some methods to TestCase
Stefan Vogel <sv@exept.de>
parents: 222
diff changeset
    46
037f084beb1b Move some methods to TestCase
Stefan Vogel <sv@exept.de>
parents: 222
diff changeset
    47
!GenericException class methodsFor:'Camp Smalltalk'!
037f084beb1b Move some methods to TestCase
Stefan Vogel <sv@exept.de>
parents: 222
diff changeset
    48
037f084beb1b Move some methods to TestCase
Stefan Vogel <sv@exept.de>
parents: 222
diff changeset
    49
sunitSignalWith: aString
037f084beb1b Move some methods to TestCase
Stefan Vogel <sv@exept.de>
parents: 222
diff changeset
    50
037f084beb1b Move some methods to TestCase
Stefan Vogel <sv@exept.de>
parents: 222
diff changeset
    51
    <resource: #skipInDebuggersWalkBack>
037f084beb1b Move some methods to TestCase
Stefan Vogel <sv@exept.de>
parents: 222
diff changeset
    52
037f084beb1b Move some methods to TestCase
Stefan Vogel <sv@exept.de>
parents: 222
diff changeset
    53
    ^self raiseSignal: aString
037f084beb1b Move some methods to TestCase
Stefan Vogel <sv@exept.de>
parents: 222
diff changeset
    54
037f084beb1b Move some methods to TestCase
Stefan Vogel <sv@exept.de>
parents: 222
diff changeset
    55
    "Modified: / 05-12-2009 / 18:29:19 / Jan Vrany <jan.vrany@fit.cvut.cz>"
037f084beb1b Move some methods to TestCase
Stefan Vogel <sv@exept.de>
parents: 222
diff changeset
    56
! !
037f084beb1b Move some methods to TestCase
Stefan Vogel <sv@exept.de>
parents: 222
diff changeset
    57
222
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 220
diff changeset
    58
!Object methodsFor:'Camp Smalltalk'!
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 220
diff changeset
    59
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 220
diff changeset
    60
sunitAddDependent: anObject
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 220
diff changeset
    61
	
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 220
diff changeset
    62
	self addDependent: anObject
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 220
diff changeset
    63
! !
236
037f084beb1b Move some methods to TestCase
Stefan Vogel <sv@exept.de>
parents: 222
diff changeset
    64
222
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 220
diff changeset
    65
!Object methodsFor:'Camp Smalltalk'!
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 220
diff changeset
    66
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 220
diff changeset
    67
sunitChanged: aspect
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 220
diff changeset
    68
	
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 220
diff changeset
    69
	self changed: aspect
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 220
diff changeset
    70
! !
236
037f084beb1b Move some methods to TestCase
Stefan Vogel <sv@exept.de>
parents: 222
diff changeset
    71
222
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 220
diff changeset
    72
!Object methodsFor:'Camp Smalltalk'!
220
c2030e11e775 sunit stuff moved
Claus Gittinger <cg@exept.de>
parents: 120
diff changeset
    73
222
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 220
diff changeset
    74
sunitRemoveDependent: anObject
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 220
diff changeset
    75
	
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 220
diff changeset
    76
	self removeDependent: anObject
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 220
diff changeset
    77
! !
236
037f084beb1b Move some methods to TestCase
Stefan Vogel <sv@exept.de>
parents: 222
diff changeset
    78
222
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 220
diff changeset
    79
!String methodsFor:'Camp Smalltalk'!
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 220
diff changeset
    80
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 220
diff changeset
    81
sunitAsSymbol
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 220
diff changeset
    82
	
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 220
diff changeset
    83
	^self asSymbol
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 220
diff changeset
    84
! !
236
037f084beb1b Move some methods to TestCase
Stefan Vogel <sv@exept.de>
parents: 222
diff changeset
    85
222
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 220
diff changeset
    86
!String methodsFor:'Camp Smalltalk'!
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 220
diff changeset
    87
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 220
diff changeset
    88
sunitMatch: aString
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 220
diff changeset
    89
	
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 220
diff changeset
    90
	^self match: aString
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 220
diff changeset
    91
! !
236
037f084beb1b Move some methods to TestCase
Stefan Vogel <sv@exept.de>
parents: 222
diff changeset
    92
222
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 220
diff changeset
    93
!String methodsFor:'deprecated'!
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 220
diff changeset
    94
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 220
diff changeset
    95
sunitSubStrings
220
c2030e11e775 sunit stuff moved
Claus Gittinger <cg@exept.de>
parents: 120
diff changeset
    96
222
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 220
diff changeset
    97
        <resource: #obsolete>
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 220
diff changeset
    98
        
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 220
diff changeset
    99
        | stream answer index |
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 220
diff changeset
   100
        answer := OrderedCollection new.
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 220
diff changeset
   101
        stream := ReadStream on: self.
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 220
diff changeset
   102
        [stream atEnd]
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 220
diff changeset
   103
                whileFalse:
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 220
diff changeset
   104
                        [[stream atEnd ifTrue: [^answer asArray].
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 220
diff changeset
   105
                        stream peek > Character space] whileFalse: [stream next].
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 220
diff changeset
   106
                        index := stream position + 1.
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 220
diff changeset
   107
                        [stream atEnd or: [stream peek <= Character space]] whileFalse: [stream next].
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 220
diff changeset
   108
                        answer
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 220
diff changeset
   109
                                add:
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 220
diff changeset
   110
                                        (self
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 220
diff changeset
   111
                                                copyFrom: index
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 220
diff changeset
   112
                                                to: stream position)].
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 220
diff changeset
   113
        ^answer asArray
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 220
diff changeset
   114
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 220
diff changeset
   115
    "Modified: / 11-09-2010 / 15:14:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 220
diff changeset
   116
! !
236
037f084beb1b Move some methods to TestCase
Stefan Vogel <sv@exept.de>
parents: 222
diff changeset
   117
222
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 220
diff changeset
   118
!Symbol methodsFor:'Camp Smalltalk'!
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 220
diff changeset
   119
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 220
diff changeset
   120
sunitAsClass
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 220
diff changeset
   121
	
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 220
diff changeset
   122
	^SUnitNameResolver classNamed: self
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 220
diff changeset
   123
! !
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 220
diff changeset
   124
236
037f084beb1b Move some methods to TestCase
Stefan Vogel <sv@exept.de>
parents: 222
diff changeset
   125
!stx_goodies_sunit class methodsFor:'documentation'!
222
8e6f482297fa Jan's 4.1 version
Claus Gittinger <cg@exept.de>
parents: 220
diff changeset
   126
236
037f084beb1b Move some methods to TestCase
Stefan Vogel <sv@exept.de>
parents: 222
diff changeset
   127
extensionsVersion_CVS
244
938d1a1386d2 moved back - got lost
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   128
    ^ '$Header: /cvs/stx/stx/goodies/sunit/extensions.st,v 1.11 2011-07-06 14:26:11 cg Exp $'
236
037f084beb1b Move some methods to TestCase
Stefan Vogel <sv@exept.de>
parents: 222
diff changeset
   129
! !