js/src/jit-test/tests/jaeger/testPropCallElem.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.

michael@0 1 // vim: set ts=8 sts=4 et sw=4 tw=99:
michael@0 2
michael@0 3 function testUKeyUObject(a, key1, key2, key3) {
michael@0 4 a.a = function () { return this.d; }
michael@0 5 a.b = function () { return this.e; }
michael@0 6 a.c = function() { return this.f; }
michael@0 7 a.d = 20;
michael@0 8 a.e = "hi";
michael@0 9 a.f = 500;
michael@0 10 assertEq(a[key1](), 20);
michael@0 11 assertEq(a[key2](), "hi");
michael@0 12 assertEq(a[key3](), 500);
michael@0 13 }
michael@0 14
michael@0 15 function testVKeyUObject(a, key1, key2, key3) {
michael@0 16 a.a = function () { return this.d; }
michael@0 17 a.b = function () { return this.e; }
michael@0 18 a.c = function() { return this.f; }
michael@0 19 a.d = 20;
michael@0 20 a.e = "hi";
michael@0 21 a.f = 500;
michael@0 22 assertEq(a["" + key1](), 20);
michael@0 23 assertEq(a["" + key2](), "hi");
michael@0 24 assertEq(a["" + key3](), 500);
michael@0 25 }
michael@0 26
michael@0 27 function testKKeyUObject(a) {
michael@0 28 a.a = function () { return this.d; }
michael@0 29 a.b = function () { return this.e; }
michael@0 30 a.c = function() { return this.f; }
michael@0 31 a.d = 20;
michael@0 32 a.e = "hi";
michael@0 33 a.f = 500;
michael@0 34 var key1 = "a";
michael@0 35 var key2 = "b";
michael@0 36 var key3 = "c";
michael@0 37 assertEq(a[key1](), 20);
michael@0 38 assertEq(a[key2](), "hi");
michael@0 39 assertEq(a[key3](), 500);
michael@0 40 }
michael@0 41
michael@0 42 function testUKeyVObject(key1, key2, key3) {
michael@0 43 a = { a: function () { return this.d; },
michael@0 44 b: function () { return this.e; },
michael@0 45 c: function () { return this.f; },
michael@0 46 d: 20,
michael@0 47 e: "hi",
michael@0 48 f: 500
michael@0 49 };
michael@0 50 assertEq(a[key1](), 20);
michael@0 51 assertEq(a[key2](), "hi");
michael@0 52 assertEq(a[key3](), 500);
michael@0 53 }
michael@0 54
michael@0 55 function testVKeyVObject(key1, key2, key3) {
michael@0 56 a = { a: function () { return this.d; },
michael@0 57 b: function () { return this.e; },
michael@0 58 c: function () { return this.f; },
michael@0 59 d: 20,
michael@0 60 e: "hi",
michael@0 61 f: 500
michael@0 62 };
michael@0 63 assertEq(a["" + key1](), 20);
michael@0 64 assertEq(a["" + key2](), "hi");
michael@0 65 assertEq(a["" + key3](), 500);
michael@0 66 }
michael@0 67
michael@0 68 function testKKeyVObject(a) {
michael@0 69 a = { a: function () { return this.d; },
michael@0 70 b: function () { return this.e; },
michael@0 71 c: function () { return this.f; },
michael@0 72 d: 20,
michael@0 73 e: "hi",
michael@0 74 f: 500
michael@0 75 };
michael@0 76 var key1 = "a";
michael@0 77 var key2 = "b";
michael@0 78 var key3 = "c";
michael@0 79 assertEq(a[key1](), 20);
michael@0 80 assertEq(a[key2](), "hi");
michael@0 81 assertEq(a[key3](), 500);
michael@0 82 }
michael@0 83
michael@0 84 for (var i = 0; i < 5; i++) {
michael@0 85 testUKeyUObject({}, "a", "b", "c");
michael@0 86 testVKeyUObject({}, "a", "b", "c");
michael@0 87 testKKeyUObject({});
michael@0 88 testUKeyVObject("a", "b", "c");
michael@0 89 testVKeyVObject("a", "b", "c");
michael@0 90 testKKeyVObject();
michael@0 91 }
michael@0 92
michael@0 93

mercurial