[[Enumerate]] and enumerate and keys trap

Allen Wirfs-Brock allen at wirfs-brock.com
Mon Oct 8 14:27:13 PDT 2012

On Oct 8, 2012, at 2:04 PM, Brendan Eich wrote:

> Allen Wirfs-Brock wrote:
>> BTW, an issue that I have seen in some ES test is an implicit assumption that the implementation factoring and abstraction layering necessarily follows that used by the specification. Just because the spec. uses procedural abstraction to define some functionality doesn't mean that the functionality can be verify by exercising only one of multiple features that depend upon it.
> Indeed, such internal details should not be observable -- so were those tests counting on leaky abstractions in certain implementation(s)?

For example,  assuming that ToNumber of an object calls valueOf can be verified by just writing a test using prefix + and not testing that use case for any other operators. 

The problem isn't not so much that ToNumber is a leaky abstraction.  It's the assumption that implementations will actually implement it as a call to a common procedure.

If can get away with such assumptions if you are doing white box testing, but not for black box tested based upon a specification.


More information about the es-discuss mailing list