Fix various test bugs (#1502)

Fixes #1492
This commit is contained in:
André Bargull 2018-03-22 13:36:57 -07:00 committed by Leo Balter
parent 5d6899522a
commit 500e48e6ce
17 changed files with 23 additions and 22 deletions

View File

@ -146,3 +146,4 @@ WeakSet
# object, go here. # object, go here.
IsHTMLDDA IsHTMLDDA
CannotSuspendMainAgent

View File

@ -1,4 +1,5 @@
typeCoercion.js: [Symbol.toPrimitive, BigInt] typeCoercion.js: [Symbol.toPrimitive, BigInt]
testAtomics.js: [ArrayBuffer, Atomics, DataView, SharedArrayBuffer, arrow-function, let, for-of] testAtomics.js: [ArrayBuffer, Atomics, DataView, SharedArrayBuffer, arrow-function, let, for-of]
testBigIntTypedArray.js: [BigInt, TypedArray]
testTypedArray.js: [TypedArray] testTypedArray.js: [TypedArray]
isConstructor.js: [Reflect.construct] isConstructor.js: [Reflect.construct]

View File

@ -8,7 +8,7 @@ description: |
/** /**
* The %TypedArray% intrinsic constructor function. * The %TypedArray% intrinsic constructor function.
*/ */
var TypedArray = Object.getPrototypeOf(BigInt64Array); var TypedArray = Object.getPrototypeOf(Int8Array);
/** /**
* Calls the provided function for every typed array constructor. * Calls the provided function for every typed array constructor.

View File

@ -46,7 +46,7 @@ var obj = {
}; };
async function* asyncg() { async function* asyncg() {
yield* obj; return yield* obj;
} }
let iter = asyncg(); let iter = asyncg();

View File

@ -6,6 +6,7 @@ description: >
When invoked via the constructor invocation pattern without arguments, the When invoked via the constructor invocation pattern without arguments, the
GeneratorFunction intrinsic returns a valid async generator with an empty body. GeneratorFunction intrinsic returns a valid async generator with an empty body.
features: [async-iteration] features: [async-iteration]
flags: [async]
---*/ ---*/
var AsyncGeneratorFunction = Object.getPrototypeOf(async function* () {}).constructor; var AsyncGeneratorFunction = Object.getPrototypeOf(async function* () {}).constructor;

View File

@ -8,6 +8,7 @@ description: >
last argument evaluated as source code and whose formal parameters are last argument evaluated as source code and whose formal parameters are
defined by the preceeding arguments. defined by the preceeding arguments.
features: [async-iteration] features: [async-iteration]
flags: [async]
---*/ ---*/
var AsyncGeneratorFunction = Object.getPrototypeOf(async function* () {}).constructor; var AsyncGeneratorFunction = Object.getPrototypeOf(async function* () {}).constructor;

View File

@ -6,6 +6,7 @@ description: >
When invoked via the function invocation pattern without arguments, the When invoked via the function invocation pattern without arguments, the
AsyncGeneratorFunction intrinsic returns a valid generator with an empty body. AsyncGeneratorFunction intrinsic returns a valid generator with an empty body.
features: [async-iteration] features: [async-iteration]
flags: [async]
---*/ ---*/
var AsyncGeneratorFunction = Object.getPrototypeOf(async function* () {}).constructor; var AsyncGeneratorFunction = Object.getPrototypeOf(async function* () {}).constructor;

View File

@ -14,7 +14,7 @@ info: |
6. Let B be AgentCanSuspend(). 6. Let B be AgentCanSuspend().
7. If B is false, throw a TypeError exception. 7. If B is false, throw a TypeError exception.
... ...
features: [Atomics, SharedArrayBuffer, TypedArray] features: [Atomics, SharedArrayBuffer, TypedArray, CannotSuspendMainAgent]
---*/ ---*/
var sab = new SharedArrayBuffer(4); var sab = new SharedArrayBuffer(4);

View File

@ -3,7 +3,7 @@
/*--- /*---
esid: sec-atomics.wait esid: sec-atomics.wait
description: description: >
Throws a TypeError if typedArray arg is not an Int32Array Throws a TypeError if typedArray arg is not an Int32Array
info: | info: |
Atomics.wait( typedArray, index, value, timeout ) Atomics.wait( typedArray, index, value, timeout )

View File

@ -24,7 +24,7 @@ $262.agent.start(
` `
$262.agent.receiveBroadcast(function (sab) { $262.agent.receiveBroadcast(function (sab) {
var int32Array = new Int32Array(sab); var int32Array = new Int32Array(sab);
$262.agent.report(Atomics.wait(int32Array, undefined, 0, 10)); // undefined index => 0 $262.agent.report(Atomics.wait(int32Array, undefined, 0, 1000)); // undefined index => 0
$262.agent.leaving(); $262.agent.leaving();
}) })
`); `);

View File

@ -28,12 +28,10 @@ $262.agent.start(
$262.agent.receiveBroadcast(function (sab) { $262.agent.receiveBroadcast(function (sab) {
var int32Array = new Int32Array(sab); var int32Array = new Int32Array(sab);
$262.agent.report(Atomics.wait(int32Array, 0, 44, 100)); $262.agent.report(Atomics.wait(int32Array, 0, 44, 1000));
$262.agent.report(Atomics.wait(int32Array, 0, 251.4, 1000)); $262.agent.report(Atomics.wait(int32Array, 0, 251.4, 1000));
$262.agent.report(Atomics.wait(int32Array, 0, Infinity, 1000));
$262.agent.leaving(); $262.agent.leaving();
}) })
`); `);
@ -45,7 +43,6 @@ $262.agent.broadcast(int32Array.buffer);
$262.agent.sleep(200); $262.agent.sleep(200);
assert.sameValue(getReport(), "not-equal");
assert.sameValue(getReport(), "not-equal"); assert.sameValue(getReport(), "not-equal");
assert.sameValue(getReport(), "not-equal"); assert.sameValue(getReport(), "not-equal");

View File

@ -42,7 +42,7 @@ $262.agent.start(
assert.sameValue(Atomics.wake(int32Array, 0), 1); assert.sameValue(Atomics.wake(int32Array, 0), 1);
assert.sameValue(getReport(), "ok"); assert.sameValue(getReport(), "ok");
assert.sameValue(sleeping < timeout, "this test assumes it won't last for more than 20 seconds"); assert(sleeping < timeout, "this test assumes it won't last for more than 20 seconds");
function getReport() { function getReport() {
var r; var r;
@ -52,4 +52,3 @@ $262.agent.start(
} }
return r; return r;
} }

View File

@ -4,7 +4,7 @@
/*--- /*---
esid: sec-promise.all esid: sec-promise.all
description: > description: >
Reject when argument is a string Resolve when argument is a string
info: | info: |
... ...
Let iteratorRecord be GetIterator(iterable). Let iteratorRecord be GetIterator(iterable).
@ -23,11 +23,11 @@ flags: [async]
---*/ ---*/
try { try {
Promise.all("").then(function() { Promise.all("").then(function(v) {
$DONE(); assert.sameValue(v.length, 0);
}, function() { }, function() {
$DONE('The promise should be resolved, but was rejected'); $DONE('The promise should be resolved, but was rejected');
}).then($DONE, $DONE); }).then($DONE, $DONE);
} catch (error) { } catch (error) {
$DONE(`The promise should be rejected, but threw an exception: ${error.message}`); $DONE(`The promise should be resolved, but threw an exception: ${error.message}`);
} }

View File

@ -37,7 +37,7 @@ Object.defineProperty(poisonedDone, 'done', {
}); });
Object.defineProperty(poisonedDone, 'value', { Object.defineProperty(poisonedDone, 'value', {
get: function() { get: function() {
$DONE('The `value` property should not be accessed.'); $ERROR('The `value` property should not be accessed.');
} }
}); });

View File

@ -4,7 +4,7 @@
/*--- /*---
esid: sec-promise.race esid: sec-promise.race
description: > description: >
Reject when argument is a string Resolve when argument is a string
info: | info: |
... ...
Let iteratorRecord be GetIterator(iterable). Let iteratorRecord be GetIterator(iterable).
@ -23,11 +23,11 @@ flags: [async]
---*/ ---*/
try { try {
Promise.race("").then(function() { Promise.race("a").then(function(v) {
$DONE(); assert.sameValue(v, "a");
}, function() { }, function() {
$DONE('The promise should be resolved, but was rejected'); $DONE('The promise should be resolved, but was rejected');
}).then($DONE, $DONE); }).then($DONE, $DONE);
} catch (error) { } catch (error) {
$DONE(`The promise should be rejected, but threw an exception: ${error.message}`); $DONE(`The promise should be resolved, but threw an exception: ${error.message}`);
} }

View File

@ -50,7 +50,7 @@ function body(FloatArray) {
var i = 0; var i = 0;
var result = sample.map(function() { var result = sample.map(function() {
return NaNs[i++]; return NaNs[i++]();
}); });
sampleBytes = new Uint8Array(sample.buffer); sampleBytes = new Uint8Array(sample.buffer);

View File

@ -29,7 +29,7 @@ try {
); );
} }
if (err.message !== 'descriptor value should be 2 Expected SameValue(«1», «0») to be true') { if (err.message !== 'descriptor value should be 2') {
$ERROR('The error thrown did not define the specified message.'); $ERROR('The error thrown did not define the specified message.');
} }
} }