On Wed, Oct 09, 2002 at 06:35:18AM +0900, Massimiliano Mirra wrote:
> On Tue, Oct 08, 2002 at 05:52:46PM +0900, Mauricio Fern?ndez wrote:
> > > would submit the object (or rather its class) to a small ad-hoc test
> > > suite, which would not only test whether it responded to (for example)
> > > #read, #write and #seek, but also check whether what gets written with
> > > #write can be later read with #read.
> 
> > What if 
> 
> Oh, I knew it was coming... ;-)
> 
> > the object represents /dev/null and you cannot read back what you 
> > wrote previously? 
> 
> If the method needs to read back, you've just caught a bug; if it does
> not need to read back, you're running the wrong test.
> 
> > It is hard to specify the right minimal semantic requirements...
> 
> Anything in particular makes you think so?

I only needed about .1s to find the /dev/null example. There must be
tons of them. If you completely specify the semantics of something, it
is too constrained, for somebody could find another use for it you
didn't think of.
 
> > > It would impose quite an overhead at runtime, but could be executed
> > > only when a global switch was turned on (--inline-tests), and would
> > > guarantee that an object really provides some functionality, not just
> > > `looks like to' as with respond_to? or Java interfaces.
> > 
> > IMHO it is a good idea if some provision is made for "non-standard"
> > behaving objects. 
> 
> I wasn't suggesting standard tests -- that would be equivalent to
> going back to type names; I was suggesting ad-hoc tests made up
> according to the needs of the method.

We'd need a summary of "best current practice" for this kind of tests so
you don't make too many assumptions. 

> 
> Massimiliano

-- 
 _           _                             
| |__   __ _| |_ ___ _ __ ___   __ _ _ __  
| '_ \ / _` | __/ __| '_ ` _ \ / _` | '_ \ 
| |_) | (_| | |_\__ \ | | | | | (_| | | | |
|_.__/ \__,_|\__|___/_| |_| |_|\__,_|_| |_|
	Running Debian GNU/Linux Sid (unstable)
batsman dot geo at yahoo dot com

Q: What's the big deal about rm, I have been deleting stuff for years?  And 
   never lost anything.. oops!
A: ...
	-- From the Frequently Unasked Questions