archives

« Bugzilla Issues Index

#1189 — “=” instead of “===” in test S13.2_A4_T2


Hi,

I’m not 100% confident that this is actually a bug in the test suite, but I’ve seen in test “S13.2_A4_T1” and “S13.2_A4_T2” (and I guess probably with neighbouring tests...) such a code:
var __constructor_was__enumed;

for (__prop in __gunc.prototype){
if (__prop = 'constructor')
__constructor_was__enumed = true;
}

I actually found them quite surprising. Why putting an assignement there (even if it’s correct with respect to the JavaScript syntax)? It seems to me that it does not serve the current purpose of this test. Of course, I may be misinterpreting this particular test. If it is the case, sorry for the noise.

Here is the code I think should be instead:

for (__prop in __gunc.prototype){
if (__prop === 'constructor')
__constructor_was__enumed = true;
}

Hoping it will help,
Martin.


I agree that the intent of the test is to loop through the prototype of the object and try to find the 'constructor', therefore the if should be "===" not an assignment.

for (__prop in __gunc.prototype){
if (__prop === 'constructor')
__constructor_was__enumed = true;
}

NOTE: This if test is never actually executed since the prototype of the Function object is not enumerable.

http://www.ecma-international.org/ecma-262/5.1/#sec-E
15.3.5.2: In Edition 5, the prototype property of Function instances is not enumerable. In Edition 3, this property was enumerable.

I'll provide a patch to switch the test to use "==="


Created attachment 39
use "===" instead of "="

I checked other enumeration loops in the ch13/13.2 section and all others are properly using "==="


Reviewed patches and is good to go.


changeset: 374:c0b147580eee
user: Brent Baker <brbaker@adobe.com>
date: Fri Jun 07 06:57:45 2013 -0400
summary: Bug 1189: use "===" instead of "=" for S13.2_A4_T1 and T2

NOTE: I am still waiting to get access to update the live website @ http://test262.ecmascript.org