Skip to content

Instantly share code, notes, and snippets.

@patmaddox
Created December 11, 2012 02:31
Show Gist options
  • Select an option

  • Save patmaddox/4255397 to your computer and use it in GitHub Desktop.

Select an option

Save patmaddox/4255397 to your computer and use it in GitHub Desktop.
Object < #STestCase.
+ newWithName: aString
^ self new name: aString; yourself.
- name: aString
name := aString.
- setUp
- tearDown
- run
self setUp.
self perform: name.
self tearDown.
STestCase < #WasRun
instanceVariableNames: 'name log'.
- initialize
super initialize.
log := OrderedCollection new.
- setUp
log add: #setUp.
- tearDown
log add: #tearDown.
- testMethod
log add: #testMethod.
- log
^ log.
Object < #STestCase
instanceVariableNames: 'name'.
+ newWithName: aString
^ self new name: aString; yourself.
- name: aString
name := aString.
- setUp
- tearDown
- run
self setUp.
self perform: name.
self tearDown.
STestCase < #WasRun
instanceVariableNames: 'log'.
- initialize
super initialize.
log := OrderedCollection new.
- setUp
log add: #setUp.
- tearDown
log add: #tearDown.
- testMethod
log add: #testMethod.
- log
^ log.
TestCase < #SUnitTest.
- test
self testRun.
- testRun
| test |
test := WasRun newWithName: 'testMethod'.
Transcript show: '!!!!!!!!!!'; show: test log; cr.
self assert: test log size equals: 0 withMessage: 'test log should be empty'.
test run.
self assert: test log size equals: 3 withMessage: 'test log should have 3 elements'.
self assert: (test log at: 1) equals: #setUp withMessage: 'test log at: 1 should equal #setUp'.
self assert: (test log at: 2) equals: #testMethod withMessage: 'test log at: 2 should equal #testMethod'.
self assert: (test log at: 3) equals: #tearDown withMessage: 'test log at: 3 should equal #tearDown'.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment