js/src/jit-test/tests/collections/Map-surfaces-1.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     1 // Map surfaces
     3 load(libdir + "iteration.js");
     5 var desc = Object.getOwnPropertyDescriptor(this, "Map");
     6 assertEq(desc.enumerable, false);
     7 assertEq(desc.configurable, true);
     8 assertEq(desc.writable, true);
    10 assertEq(typeof Map, 'function');
    11 assertEq(Object.keys(Map).length, 0);
    12 assertEq(Map.length, 0);
    13 assertEq(Map.name, "Map");
    15 assertEq(Object.getPrototypeOf(Map.prototype), Object.prototype);
    16 assertEq(Object.prototype.toString.call(Map.prototype), "[object Map]");
    17 assertEq(Object.prototype.toString.call(new Map), "[object Map]");
    18 assertEq(Object.prototype.toString.call(Map()), "[object Map]");
    19 assertEq(Object.keys(Map.prototype).join(), "");
    20 assertEq(Map.prototype.constructor, Map);
    22 function checkMethod(name, arity) { 
    23     var desc = Object.getOwnPropertyDescriptor(Map.prototype, name);
    24     assertEq(desc.enumerable, false);
    25     assertEq(desc.configurable, true);
    26     assertEq(desc.writable, true);
    27     assertEq(typeof desc.value, 'function');
    28     assertEq(desc.value.name, name);
    29     assertEq(desc.value.length, arity);
    30 }
    32 checkMethod("get", 1);
    33 checkMethod("has", 1);
    34 checkMethod("set", 2);
    35 checkMethod("delete", 1);
    36 checkMethod("keys", 0);
    37 checkMethod("values", 0);
    38 checkMethod("entries", 0);
    40 var desc = Object.getOwnPropertyDescriptor(Map.prototype, "size");
    41 assertEq(desc.enumerable, false);
    42 assertEq(desc.configurable, true);
    43 assertEq(typeof desc.get, 'function');
    44 assertEq(desc.get.length, 0);
    45 assertEq(desc.set, undefined);
    46 checkMethod("clear", 0);
    48 // Map.prototype[@@iterator] and .entries are the same function object.
    49 assertEq(Map.prototype[std_iterator], Map.prototype.entries);

mercurial