SUnit Testing merged with Examples for Methods

Simon Michael simon at joyful.com
Wed Dec 5 18:52:33 UTC 2001


Ted, thanks for tackling this. I look forward to trying out your code.

I like the idea of connecting examples and tests and I thought I'd
mention python's doctest framework. There, examples are embedded in
the documentation strings within the code, along with the output that
would appear in an interactive session; these can also be run as
tests. Eg

 """
 addOne is used as follows: 

 >>> addOne(1)
 2
 >>> addOne('')
 None

 (run these tests with "doctest file.py")
 """

I find this makes a nice complement to the heavier sunit style of test
framework. Maybe it would be useful in squeak, maybe not. I tried to
imagine how it would fit..

For one thing there's no existing recognizable '>>>' prompt to flag
code snippets. For another, the printed response to many squeak
messages will be "an ObjectOfSomeKind (someunpredictablenumber)". To
make tests like these work, I guess one could assume a python-like
read-eval-print loop with the instance numbers stripped out.

Regards,
-Simon




More information about the Squeak-dev mailing list