michael@0: // Map surfaces michael@0: michael@0: load(libdir + "iteration.js"); michael@0: michael@0: var desc = Object.getOwnPropertyDescriptor(this, "Map"); michael@0: assertEq(desc.enumerable, false); michael@0: assertEq(desc.configurable, true); michael@0: assertEq(desc.writable, true); michael@0: michael@0: assertEq(typeof Map, 'function'); michael@0: assertEq(Object.keys(Map).length, 0); michael@0: assertEq(Map.length, 0); michael@0: assertEq(Map.name, "Map"); michael@0: michael@0: assertEq(Object.getPrototypeOf(Map.prototype), Object.prototype); michael@0: assertEq(Object.prototype.toString.call(Map.prototype), "[object Map]"); michael@0: assertEq(Object.prototype.toString.call(new Map), "[object Map]"); michael@0: assertEq(Object.prototype.toString.call(Map()), "[object Map]"); michael@0: assertEq(Object.keys(Map.prototype).join(), ""); michael@0: assertEq(Map.prototype.constructor, Map); michael@0: michael@0: function checkMethod(name, arity) { michael@0: var desc = Object.getOwnPropertyDescriptor(Map.prototype, name); michael@0: assertEq(desc.enumerable, false); michael@0: assertEq(desc.configurable, true); michael@0: assertEq(desc.writable, true); michael@0: assertEq(typeof desc.value, 'function'); michael@0: assertEq(desc.value.name, name); michael@0: assertEq(desc.value.length, arity); michael@0: } michael@0: michael@0: checkMethod("get", 1); michael@0: checkMethod("has", 1); michael@0: checkMethod("set", 2); michael@0: checkMethod("delete", 1); michael@0: checkMethod("keys", 0); michael@0: checkMethod("values", 0); michael@0: checkMethod("entries", 0); michael@0: michael@0: var desc = Object.getOwnPropertyDescriptor(Map.prototype, "size"); michael@0: assertEq(desc.enumerable, false); michael@0: assertEq(desc.configurable, true); michael@0: assertEq(typeof desc.get, 'function'); michael@0: assertEq(desc.get.length, 0); michael@0: assertEq(desc.set, undefined); michael@0: checkMethod("clear", 0); michael@0: michael@0: // Map.prototype[@@iterator] and .entries are the same function object. michael@0: assertEq(Map.prototype[std_iterator], Map.prototype.entries);