[self-interest] selfUnit

Thorsten Dittmar thorsten.dittmar at daedalos.com
Mon Jun 10 09:03:29 UTC 2002


For my current work I need a testing framework, so I start porting sUnit to
self. For the first step it is only necessary to have something like sUnit
on self, so I stopped all my though about the exact meaning of a unit for
self. That can be done in the next step.

sUnit is heavily based on exception handling. It try to find out, if there
is something similar to this in self and as far as I can say now, it is not.
Of course it would be easily possible to implement something like this, but
a system change like this was not my intention.

So as an alternative I looked at the process model and found it useful for
the requirements of sUnit: (send one test message after another to an
object, catch all errors and count the errors, warning and successful calls)

My current implementation idea will fork a process for every call and if the
causeOfDeath = 'terminated' it was a successful run.

I want to change the implementation of warning: string a little bit. In the
moment it looks into the preferences and when the slot noisy is true it make
a beep and wrote a string to stOut. I want to add a list warning to a
subprototype of process to collect all warnings.

So if causeOfDeath is something else then 'terminated' and causeOfError is
not ok anymore it would be an error.

So far so good. My problem is to make sure that "no" error will pop up a
debugger or so. My current idea is the implement a special version of the
mixin schedulerCalls. Normally when an error occurs the process start a
communication sequence with the scheduler to create a debugger

suspendAndTrace: error
 causeOfError: error.
 performInScheduler: suspendAndTraceAction
          IfInside: [scheduler suspendAndTrace: self].
 self

performInScheduler: IfInside: is implemented in this mixin as:

 scheduler inScheduler ifTrue: blk False: [_Yield: action]


Using dynamic inheritance it can be exchanged by

 scheduler inScheduler ifTrue: [scheduler abort: self] False: [_Yield:
abortAction]
 
What do you think about this. Do you know a easier solution?

Thorsten Dittmar




More information about the Self-interest mailing list