Merge pull request #1481 from bocoup/anba-fixes

TypedArray and Async Iteration bug fixes
This commit is contained in:
Leo Balter 2018-03-09 10:39:34 -05:00 committed by GitHub
commit 3854fc38dd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 48 additions and 52 deletions

View File

@ -12,7 +12,6 @@ info: |
...
18. Return promiseCapability.[[Promise]].
flags: [async]
features: [async-iteration]
---*/

View File

@ -60,4 +60,5 @@ iter.next().then(function (result) {
}).then($DONE, $DONE);
}
).catch($DONE);
}).then($DONE, $DONE);
}).catch($DONE);

View File

@ -30,15 +30,15 @@ var obj = {
[Symbol.iterator]() {
return {
next() {
return { value: 1, done: false };
return { value: 1, done: false };
},
throw() {
return {
get done() {
throw thrownError;
},
value: 1
}
return {
get done() {
throw thrownError;
},
value: 1
};
}
};
}
@ -60,8 +60,8 @@ iter.next().then(function(result) {
assert.sameValue(err, thrownError, "Promise should be rejected with thrown error");
iter.next().then(({ done, value }) => {
assert.sameValue(done, true, 'the iterator is completed');
assert.sameValue(value, undefined, 'value is undefined');
assert.sameValue(done, true, 'the iterator is completed');
assert.sameValue(value, undefined, 'value is undefined');
}).then($DONE, $DONE);
}
).catch($DONE);

View File

@ -30,15 +30,15 @@ var obj = {
[Symbol.iterator]() {
return {
next() {
return { value: 1, done: false };
return { value: 1, done: false };
},
throw() {
return {
get value() {
throw thrownError;
},
done: false
}
return {
get value() {
throw thrownError;
},
done: false
};
}
}
}
@ -60,8 +60,8 @@ iter.next().then(function(result) {
assert.sameValue(err, thrownError, "Promise should be rejected with thrown error");
iter.next().then(({ done, value }) => {
assert.sameValue(done, true, 'the iterator is completed');
assert.sameValue(value, undefined, 'value is undefined');
assert.sameValue(done, true, 'the iterator is completed');
assert.sameValue(value, undefined, 'value is undefined');
}).then($DONE, $DONE);
}
).catch($DONE);

View File

@ -33,13 +33,13 @@ var obj = {
[Symbol.iterator]() {
return {
next() {
return { value: 1, done: false };
return { value: 1, done: false };
},
throw() {
return {
value: Promise.resolve(42),
done: true
};
return {
value: Promise.resolve(42),
done: true
};
}
};
}
@ -57,9 +57,9 @@ iter.next().then(function (result) {
assert.sameValue(result.value, 42, "Result.value should be unwrapped, got: " + result.value);
iter.next().then(({ done, value }) => {
assert.sameValue(done, true, 'the iterator is completed');
assert.sameValue(value, undefined, 'value is undefined');
assert.sameValue(done, true, 'the iterator is completed');
assert.sameValue(value, undefined, 'value is undefined');
}).then($DONE, $DONE);
}
).catch($DONE);
}).then($DONE, $DONE);
}).catch($DONE);

View File

@ -50,8 +50,8 @@ iter.next().then(function(result) {
assert.sameValue(err, thrownError, "promise should be reject with custom error, got: " + err)
iter.next().then(({ done, value }) => {
assert.sameValue(done, true, 'the iterator is completed');
assert.sameValue(value, undefined, 'value is undefined');
assert.sameValue(done, true, 'the iterator is completed');
assert.sameValue(value, undefined, 'value is undefined');
}).then($DONE, $DONE);
}
).catch($DONE);

View File

@ -24,12 +24,12 @@ var obj = {
[Symbol.iterator]() {
return {
next() {
return { value: 1, done: false };
return { value: 1, done: false };
},
get throw() {
throw thrownError;
throw thrownError;
}
}
};
}
};
@ -49,11 +49,10 @@ iter.next().then(function(result) {
assert.sameValue(err, thrownError, "Promise should be rejected with thrown error");
iter.next().then(({ done, value }) => {
assert.sameValue(done, true, 'the iterator is completed');
assert.sameValue(value, undefined, 'value is undefined');
assert.sameValue(done, true, 'the iterator is completed');
assert.sameValue(value, undefined, 'value is undefined');
}).then($DONE, $DONE);
}
).catch($DONE);
}).catch($DONE);

View File

@ -27,10 +27,10 @@ var obj = {
[Symbol.iterator]() {
return {
next() {
return { value: 1, done: false };
return { value: 1, done: false };
},
throw() {
throw thrownError;
throw thrownError;
}
};
}
@ -52,10 +52,9 @@ iter.next().then(function(result) {
assert.sameValue(err, thrownError, "Promise should be rejected with thrown error");
iter.next().then(({ done, value }) => {
assert.sameValue(done, true, 'the iterator is completed');
assert.sameValue(value, undefined, 'value is undefined');
assert.sameValue(done, true, 'the iterator is completed');
assert.sameValue(value, undefined, 'value is undefined');
}).then($DONE, $DONE);
}
).catch($DONE);
}).catch($DONE);

View File

@ -28,10 +28,10 @@ var obj = {
[Symbol.iterator]() {
return {
next() {
return { value: 1, done: false };
return { value: 1, done: false };
},
throw() {
return 1;
return 1;
}
};
}
@ -54,8 +54,8 @@ iter.next().then(function(result) {
assert(typeerror, "Expect TypeError, got: " + err);
iter.next().then(({ done, value }) => {
assert.sameValue(done, true, 'the iterator is completed');
assert.sameValue(value, undefined, 'value is undefined');
assert.sameValue(done, true, 'the iterator is completed');
assert.sameValue(value, undefined, 'value is undefined');
}).then($DONE, $DONE);
}
).catch($DONE);

View File

@ -23,7 +23,7 @@ var obj = {
[Symbol.iterator]() {
return {
next() {
return { value: 1, done: false };
return { value: 1, done: false };
}
};
}
@ -36,7 +36,6 @@ async function* asyncg() {
var iter = asyncg();
iter.next().then(function(result) {
iter.throw().then(
function (result) {
throw new Test262Error("Promise should be rejected, got: " + result.value);
@ -45,11 +44,10 @@ iter.next().then(function(result) {
assert.sameValue(err, undefined, "Promise should be rejected with undefined");
iter.next().then(({ done, value }) => {
assert.sameValue(done, true, 'the iterator is completed');
assert.sameValue(value, undefined, 'value is undefined');
assert.sameValue(done, true, 'the iterator is completed');
assert.sameValue(value, undefined, 'value is undefined');
}).then($DONE, $DONE);
}
).catch($DONE);
}).catch($DONE);

View File

@ -29,4 +29,4 @@ testWithTypedArrayConstructors(function(TA) {
assert.throws(RangeError, function() {
new TA(buffer, 0, undefined);
});
});
}, [ Float64Array, Float32Array, Int32Array, Int16Array, Uint32Array, Uint16Array ]);

View File

@ -24,4 +24,4 @@ testWithTypedArrayConstructors(function(TA) {
assert.throws(RangeError, function() {
new TA(buffer, 7);
});
});
}, [ Float64Array, Float32Array, Int32Array, Int16Array, Uint32Array, Uint16Array ]);