Skip to content
Snippets Groups Projects
  • André Bargull's avatar
    20426679
    Fix various test issues (#840) · 20426679
    André Bargull authored
    test/annexB/built-ins/Date/prototype/setYear/time-clip.js
    test/built-ins/Date/prototype/setFullYear/new-value-time-clip.js
    test/built-ins/Date/prototype/setMonth/new-value-time-clip.js
    - Don't try to test time-clip at the end points, because this is near
    impossible to get right (needs to consider time zone offset, dst, local
    mean time because of Africa/Monrovia, etc.).
    
    test/built-ins/DataView/prototype/setFloat64/detached-buffer-after-toindex-byteoffset.js
    test/built-ins/DataView/prototype/setInt16/detached-buffer-after-toindex-byteoffset.js
    - Wasn't update to expect RangeError
    
    test/built-ins/Function/internals/Construct/derived-this-uninitialized-realm.js
    - Change ClassDeclaration -> ClassExpression to get completion value
    
    test/built-ins/Function/prototype/toString/AsyncFunction.js
    - Add missing \n in expected string
    - Also fixed in gh-847
    
    test/built-ins/global/global-object.js
    - Add 'var' to make test pass in strict-mode
    
    test/language/block-scope/syntax/redeclaration-in-block/attempt-to-redeclare-function-declaration-with-function-declaration.js
    - This is allowed in sloppy mode when Annex B is implemented
    
    test/language/expressions/async-generators/expression-yield-as-statement.js
    - Fix calls to then()
    
    test/language/module-code/namespace/internals/own-property-keys-binding-types.js
    test/language/module-code/namespace/internals/own-property-keys-sort.js
    - Tests weren't updated after removal of @@iterator from module
    namespace objects
    
    test/language/module-code/namespace/internals/set-prototype-of-null.js
    - Fix syntax error
    
    test/language/statements/async-function/early-errors-no-async-generator.js
    - No longer valid now that async iteration proposal is at stage 3
    20426679
    History
    Fix various test issues (#840)
    André Bargull authored
    test/annexB/built-ins/Date/prototype/setYear/time-clip.js
    test/built-ins/Date/prototype/setFullYear/new-value-time-clip.js
    test/built-ins/Date/prototype/setMonth/new-value-time-clip.js
    - Don't try to test time-clip at the end points, because this is near
    impossible to get right (needs to consider time zone offset, dst, local
    mean time because of Africa/Monrovia, etc.).
    
    test/built-ins/DataView/prototype/setFloat64/detached-buffer-after-toindex-byteoffset.js
    test/built-ins/DataView/prototype/setInt16/detached-buffer-after-toindex-byteoffset.js
    - Wasn't update to expect RangeError
    
    test/built-ins/Function/internals/Construct/derived-this-uninitialized-realm.js
    - Change ClassDeclaration -> ClassExpression to get completion value
    
    test/built-ins/Function/prototype/toString/AsyncFunction.js
    - Add missing \n in expected string
    - Also fixed in gh-847
    
    test/built-ins/global/global-object.js
    - Add 'var' to make test pass in strict-mode
    
    test/language/block-scope/syntax/redeclaration-in-block/attempt-to-redeclare-function-declaration-with-function-declaration.js
    - This is allowed in sloppy mode when Annex B is implemented
    
    test/language/expressions/async-generators/expression-yield-as-statement.js
    - Fix calls to then()
    
    test/language/module-code/namespace/internals/own-property-keys-binding-types.js
    test/language/module-code/namespace/internals/own-property-keys-sort.js
    - Tests weren't updated after removal of @@iterator from module
    namespace objects
    
    test/language/module-code/namespace/internals/set-prototype-of-null.js
    - Fix syntax error
    
    test/language/statements/async-function/early-errors-no-async-generator.js
    - No longer valid now that async iteration proposal is at stage 3
expression-yield-as-statement.js 1.41 KiB
// Copyright 2017 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/*---
author: Caitlin Potter <caitp@igalia.com>
esid: 14.4
description: >
  `yield` is a valid statement within async generator function bodies.
flags: [async]
---*/

var g1 = async function*() { yield; };
var g2 = async function*() { yield 1; };

var iter1 = g1();
iter1.next().then(function(result) {
  assert.sameValue(
    result.value, undefined, "Without right-hand-side: first result `value`");
  assert.sameValue(
    result.done, false, "Without right-hand-side: first result `done` flag");
}).then(undefined, $DONE);
iter1.next().then(function(result) {
  assert.sameValue(
    result.value, undefined, "Without right-hand-side: second result `value`");
  assert.sameValue(
    result.done, true, "Without right-hand-side: second result `done` flag");
}).then(undefined, $DONE);

var iter2 = g2();
iter2.next().then(function(result) {
  assert.sameValue(
    result.value, 1, "With right-hand-side: first result `value`");
  assert.sameValue(
    result.done, false, "With right-hand-side: first result `done` flag");
}).then(undefined, $DONE);
iter2.next().then(function(result) {
  assert.sameValue(
    result.value, undefined, "With right-hand-side: second result `value`");
  assert.sameValue(
    result.done, true, "With right-hand-side: second result `done` flag");
}).then($DONE, $DONE);