mirror of https://github.com/tc39/test262.git
split "expectedThis" cases into strict/nonstrict branches
This commit is contained in:
parent
26787ab09b
commit
f544773583
|
@ -6,16 +6,16 @@ info: >
|
|||
Promise reaction jobs have predictable environment
|
||||
author: Sam Mikes
|
||||
description: Promise.onFulfilled gets undefined as 'this'
|
||||
flags: [noStrict]
|
||||
includes: [fnGlobalObject.js]
|
||||
---*/
|
||||
|
||||
var expectedThis,
|
||||
var expectedThis = fnGlobalObject(),
|
||||
obj = {};
|
||||
|
||||
(function () { expectedThis = this; }());
|
||||
|
||||
var p = Promise.resolve(obj).then(function(arg) {
|
||||
if (this !== expectedThis) {
|
||||
$ERROR("'this' must be same as for function called without explicit this got " + this);
|
||||
$ERROR("'this' must be global object, got " + this);
|
||||
}
|
||||
if (arg !== obj) {
|
||||
$ERROR("Expected promise to be fulfilled by obj, actually " + arg);
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
// Copyright 2014 Cubane Canada, Inc. All rights reserved.
|
||||
// See LICENSE for details.
|
||||
|
||||
/*---
|
||||
info: >
|
||||
Promise reaction jobs have predictable environment
|
||||
author: Sam Mikes
|
||||
description: Promise.onFulfilled gets undefined as 'this'
|
||||
flags: [onlyStrict]
|
||||
---*/
|
||||
|
||||
var expectedThis = undefined,
|
||||
obj = {};
|
||||
|
||||
var p = Promise.resolve(obj).then(function(arg) {
|
||||
if (this !== expectedThis) {
|
||||
$ERROR("'this' must be undefined, got " + this);
|
||||
}
|
||||
if (arg !== obj) {
|
||||
$ERROR("Expected promise to be fulfilled by obj, actually " + arg);
|
||||
}
|
||||
}).then($DONE, $DONE);
|
|
@ -8,18 +8,18 @@ info: >
|
|||
undefined in strict mode
|
||||
author: Sam Mikes
|
||||
description: onRejected gets default 'this'
|
||||
flags: [noStrict]
|
||||
includes: [fnGlobalObject.js]
|
||||
---*/
|
||||
|
||||
var expectedThis,
|
||||
var expectedThis = fnGlobalObject(),
|
||||
obj = {};
|
||||
|
||||
(function () { expectedThis = this; }());
|
||||
|
||||
var p = Promise.reject(obj).then(function () {
|
||||
$ERROR("Unexpected fulfillment; expected rejection.");
|
||||
}, function(arg) {
|
||||
if (this !== expectedThis) {
|
||||
$ERROR("'this' must be same as for function called without explicit this, got " + this);
|
||||
$ERROR("'this' must be global object, got " + this);
|
||||
}
|
||||
|
||||
if (arg !== obj) {
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
// Copyright 2014 Cubane Canada, Inc. All rights reserved.
|
||||
// See LICENSE for details.
|
||||
|
||||
/*---
|
||||
info: >
|
||||
Promise reaction jobs have predictable environment
|
||||
'this' is global object in sloppy mode,
|
||||
undefined in strict mode
|
||||
author: Sam Mikes
|
||||
description: onRejected gets default 'this'
|
||||
flags: [onlyStrict]
|
||||
---*/
|
||||
|
||||
var expectedThis = undefined,
|
||||
obj = {};
|
||||
|
||||
var p = Promise.reject(obj).then(function () {
|
||||
$ERROR("Unexpected fulfillment; expected rejection.");
|
||||
}, function(arg) {
|
||||
if (this !== expectedThis) {
|
||||
$ERROR("'this' must be undefined, got " + this);
|
||||
}
|
||||
|
||||
if (arg !== obj) {
|
||||
$ERROR("Expected promise to be rejected with obj, actually " + arg);
|
||||
}
|
||||
}).then($DONE, $DONE);
|
|
@ -8,15 +8,15 @@ info: >
|
|||
undefined in strict mode
|
||||
author: Sam Mikes
|
||||
description: Promise executor gets default handling for 'this'
|
||||
flags: [noStrict]
|
||||
includes: [fnGlobalObject.js]
|
||||
---*/
|
||||
|
||||
var expectedThis;
|
||||
|
||||
(function () { expectedThis = this; }());
|
||||
var expectedThis = fnGlobalObject();
|
||||
|
||||
var p = new Promise(function (resolve) {
|
||||
if (this !== expectedThis) {
|
||||
$ERROR("'this' must be same as for function called without explicit this, got " + this);
|
||||
$ERROR("'this' must be global object, got " + this);
|
||||
}
|
||||
|
||||
resolve();
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
// Copyright 2014 Cubane Canada, Inc. All rights reserved.
|
||||
// See LICENSE for details.
|
||||
|
||||
/*---
|
||||
info: >
|
||||
Promise executor has predictable environment
|
||||
'this' should be global object in sloppy mode,
|
||||
undefined in strict mode
|
||||
author: Sam Mikes
|
||||
description: Promise executor gets default handling for 'this'
|
||||
flags: [onlyStrict]
|
||||
---*/
|
||||
|
||||
var expectedThis = undefined;
|
||||
|
||||
var p = new Promise(function (resolve) {
|
||||
if (this !== expectedThis) {
|
||||
$ERROR("'this' must be undefined, got " + this);
|
||||
}
|
||||
|
||||
resolve();
|
||||
}).then($DONE, $DONE);
|
Loading…
Reference in New Issue