Skip to content
Snippets Groups Projects
Commit 500e48e6 authored by André Bargull's avatar André Bargull Committed by Leo Balter
Browse files

Fix various test bugs (#1502)

Fixes #1492
parent 5d689952
No related branches found
No related tags found
No related merge requests found
Showing
with 23 additions and 22 deletions
...@@ -146,3 +146,4 @@ WeakSet ...@@ -146,3 +146,4 @@ WeakSet
# object, go here. # object, go here.
IsHTMLDDA IsHTMLDDA
CannotSuspendMainAgent
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]
...@@ -8,7 +8,7 @@ description: | ...@@ -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.
......
...@@ -46,7 +46,7 @@ var obj = { ...@@ -46,7 +46,7 @@ var obj = {
}; };
async function* asyncg() { async function* asyncg() {
yield* obj; return yield* obj;
} }
let iter = asyncg(); let iter = asyncg();
......
...@@ -6,6 +6,7 @@ description: > ...@@ -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;
......
...@@ -8,6 +8,7 @@ description: > ...@@ -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;
......
...@@ -6,6 +6,7 @@ description: > ...@@ -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;
......
...@@ -14,7 +14,7 @@ info: | ...@@ -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);
......
...@@ -3,7 +3,7 @@ ...@@ -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 )
......
...@@ -24,7 +24,7 @@ $262.agent.start( ...@@ -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();
}) })
`); `);
......
...@@ -28,11 +28,9 @@ $262.agent.start( ...@@ -28,11 +28,9 @@ $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); ...@@ -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");
......
...@@ -42,7 +42,7 @@ $262.agent.start( ...@@ -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( ...@@ -52,4 +52,3 @@ $262.agent.start(
} }
return r; return r;
} }
\ No newline at end of file
...@@ -4,7 +4,7 @@ ...@@ -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] ...@@ -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}`);
} }
...@@ -37,7 +37,7 @@ Object.defineProperty(poisonedDone, 'done', { ...@@ -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.');
} }
}); });
......
...@@ -4,7 +4,7 @@ ...@@ -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] ...@@ -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}`);
} }
...@@ -50,7 +50,7 @@ function body(FloatArray) { ...@@ -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);
......
...@@ -29,7 +29,7 @@ try { ...@@ -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.');
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment