js/src/jit-test/tests/basic/spread-call-this-strict.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/js/src/jit-test/tests/basic/spread-call-this-strict.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,105 @@
     1.4 +"use strict";
     1.5 +
     1.6 +let global = this;
     1.7 +let p = {};
     1.8 +let q = {};
     1.9 +
    1.10 +let g1 = function() {
    1.11 +  assertEq(this, undefined);
    1.12 +};
    1.13 +g1(...[]);
    1.14 +
    1.15 +let g2 = x => {
    1.16 +  assertEq(this, global);
    1.17 +};
    1.18 +g2(...[]);
    1.19 +
    1.20 +let g3 = function() {
    1.21 +  assertEq(this, p);
    1.22 +};
    1.23 +g3.apply(p, ...[]);
    1.24 +g3.call(p, ...[]);
    1.25 +
    1.26 +g2.apply(p, ...[]);
    1.27 +g2.call(p, ...[]);
    1.28 +
    1.29 +let o = {
    1.30 +  f1: function() {
    1.31 +    assertEq(this, o);
    1.32 +
    1.33 +    let g1 = function() {
    1.34 +      assertEq(this, undefined);
    1.35 +    };
    1.36 +    g1(...[]);
    1.37 +
    1.38 +    let g2 = x => {
    1.39 +      assertEq(this, o);
    1.40 +    };
    1.41 +    g2(...[]);
    1.42 +
    1.43 +    let g3 = function() {
    1.44 +      assertEq(this, q);
    1.45 +    };
    1.46 +    g3.apply(q, ...[]);
    1.47 +    g3.call(q, ...[]);
    1.48 +
    1.49 +    let g4 = x => {
    1.50 +      assertEq(this, o);
    1.51 +    };
    1.52 +    g4.apply(q, ...[]);
    1.53 +    g4.call(q, ...[]);
    1.54 +  },
    1.55 +  f2: x => {
    1.56 +    assertEq(this, global);
    1.57 +    let g1 = function() {
    1.58 +      assertEq(this, undefined);
    1.59 +    };
    1.60 +    g1(...[]);
    1.61 +
    1.62 +    let g2 = x => {
    1.63 +      assertEq(this, global);
    1.64 +    };
    1.65 +    g2(...[]);
    1.66 +
    1.67 +    let g3 = function() {
    1.68 +      assertEq(this, q);
    1.69 +    };
    1.70 +    g3.apply(q, ...[]);
    1.71 +    g3.call(q, ...[]);
    1.72 +
    1.73 +    let g4 = x => {
    1.74 +      assertEq(this, global);
    1.75 +    };
    1.76 +    g4.apply(q, ...[]);
    1.77 +    g4.call(q, ...[]);
    1.78 +  },
    1.79 +  f3: function() {
    1.80 +    assertEq(this, p);
    1.81 +
    1.82 +    let g1 = function() {
    1.83 +      assertEq(this, undefined);
    1.84 +    };
    1.85 +    g1(...[]);
    1.86 +
    1.87 +    let g2 = x => {
    1.88 +      assertEq(this, p);
    1.89 +    };
    1.90 +    g2(...[]);
    1.91 +
    1.92 +    let g3 = function() {
    1.93 +      assertEq(this, q);
    1.94 +    };
    1.95 +    g3.apply(q, ...[]);
    1.96 +    g3.call(q, ...[]);
    1.97 +
    1.98 +    let g4 = x => {
    1.99 +      assertEq(this, p);
   1.100 +    };
   1.101 +    g4.apply(q, ...[]);
   1.102 +    g4.call(q, ...[]);
   1.103 +  }
   1.104 +};
   1.105 +o.f1(...[]);
   1.106 +o.f2(...[]);
   1.107 +o.f3.apply(p, ...[]);
   1.108 +o.f2.apply(p, ...[]);

mercurial