Adjust testing for Object.defineProperties(obj, string) to account for index properties showing up as enumerable on String objects. r=sparky

This commit is contained in:
Jeff Walden 2010-01-04 15:53:50 -06:00
Родитель 5be7758e0f
Коммит 407fd0e5ef
1 изменённых файлов: 15 добавлений и 7 удалений

Просмотреть файл

@ -84,16 +84,24 @@ Object.defineProperties(o, 5); // ToObject only throws for null/undefined
assertEq("foo" in o, false, "foo is not an enumerable own property");
Object.defineProperties(o, false);
assertEq("bar" in o, false, "bar is not an enumerable own property");
Object.defineProperties(o, "");
assertEq("quux" in o, false, "quux is not an enumerable own property");
/*
* There's potential ambiguity over whether indexes should show up as enumerable
* own properties here, so don't run this bit yet until correctness is verified.
*/
if (false)
error = "before";
try
{
Object.defineProperties(o, "baz");
assertEq("quux" in o, false, "quux is not an enumerable own property");
Object.defineProperties(o, "1");
}
catch (e)
{
if (e instanceof TypeError)
error = "typeerror";
else
error = "bad exception: " + e;
}
assertEq(error, "typeerror",
"should throw on Properties == '1' due to '1'[0] not being a " +
"property descriptor");
error = "before";
try