WeakMap-surfaces.js (1101B)
1 // WeakMap surfaces 2 3 var desc = Object.getOwnPropertyDescriptor(this, "WeakMap"); 4 assertEq(desc.enumerable, false); 5 assertEq(desc.configurable, true); 6 assertEq(desc.writable, true); 7 8 assertEq(typeof WeakMap, 'function'); 9 assertEq(Object.keys(WeakMap).length, 0); 10 assertEq(WeakMap.length, 0); 11 assertEq(WeakMap.name, "WeakMap"); 12 13 assertEq(Object.getPrototypeOf(WeakMap.prototype), Object.prototype); 14 assertEq(Object.prototype.toString.call(WeakMap.prototype), "[object WeakMap]"); 15 assertEq(Object.prototype.toString.call(new WeakMap()), "[object WeakMap]"); 16 assertEq(Object.keys(WeakMap.prototype).join(), ""); 17 assertEq(WeakMap.prototype.constructor, WeakMap); 18 19 function checkMethod(name, arity) { 20 var desc = Object.getOwnPropertyDescriptor(WeakMap.prototype, name); 21 assertEq(desc.enumerable, false); 22 assertEq(desc.configurable, true); 23 assertEq(desc.writable, true); 24 assertEq(typeof desc.value, 'function'); 25 assertEq(desc.value.name, name); 26 assertEq(desc.value.length, arity); 27 } 28 29 checkMethod("get", 1); 30 checkMethod("has", 1); 31 checkMethod("set", 2); 32 checkMethod("delete", 1);