From 204266794c93dc917008c9db68e34cb9f94db1d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Bargull?= <andre.bargull@gmail.com> Date: Tue, 7 Feb 2017 17:10:56 +0100 Subject: [PATCH] Fix various test issues (#840) 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 --- .../built-ins/Date/prototype/setYear/time-clip.js | 4 ++-- .../detached-buffer-after-toindex-byteoffset.js | 2 +- .../detached-buffer-after-toindex-byteoffset.js | 2 +- .../prototype/setFullYear/new-value-time-clip.js | 2 +- .../Date/prototype/setMonth/new-value-time-clip.js | 2 +- .../Construct/derived-this-uninitialized-realm.js | 4 ++-- test/built-ins/global/global-object.js | 2 +- ...nction-declaration-with-function-declaration.js | 1 + .../expression-yield-as-statement.js | 4 ++-- .../internals/own-property-keys-binding-types.js | 2 +- .../namespace/internals/own-property-keys-sort.js | 2 +- .../namespace/internals/set-prototype-of-null.js | 2 +- .../early-errors-no-async-generator.js | 14 -------------- 13 files changed, 15 insertions(+), 28 deletions(-) delete mode 100644 test/language/statements/async-function/early-errors-no-async-generator.js diff --git a/test/annexB/built-ins/Date/prototype/setYear/time-clip.js b/test/annexB/built-ins/Date/prototype/setYear/time-clip.js index 27352d0e34..c1f0883ea4 100644 --- a/test/annexB/built-ins/Date/prototype/setYear/time-clip.js +++ b/test/annexB/built-ins/Date/prototype/setYear/time-clip.js @@ -15,7 +15,7 @@ info: | var date; -date = new Date(1970, 8, 12, 20, 0, 0, 0); +date = new Date(1970, 8, 10, 0, 0, 0, 0); assert.notSameValue( date.setYear(275760), NaN, 'method return value (valid date)' @@ -24,7 +24,7 @@ assert.notSameValue( date.valueOf(), NaN, '[[DateValue]] internal slot (valid date)' ); -date = new Date(1970, 8, 12, 20, 0, 0, 1); +date = new Date(1970, 8, 14, 0, 0, 0, 0); assert.sameValue( date.setYear(275760), NaN, 'method return value (invalid date)' diff --git a/test/built-ins/DataView/prototype/setFloat64/detached-buffer-after-toindex-byteoffset.js b/test/built-ins/DataView/prototype/setFloat64/detached-buffer-after-toindex-byteoffset.js index 367c749def..341c520b51 100644 --- a/test/built-ins/DataView/prototype/setFloat64/detached-buffer-after-toindex-byteoffset.js +++ b/test/built-ins/DataView/prototype/setFloat64/detached-buffer-after-toindex-byteoffset.js @@ -28,7 +28,7 @@ var sample = new DataView(buffer, 0); $DETACHBUFFER(buffer); -assert.throws(TypeError, function() { +assert.throws(RangeError, function() { sample.setFloat64(Infinity, 0); }, "Infinity"); diff --git a/test/built-ins/DataView/prototype/setInt16/detached-buffer-after-toindex-byteoffset.js b/test/built-ins/DataView/prototype/setInt16/detached-buffer-after-toindex-byteoffset.js index f193bde4fe..d619af6c14 100644 --- a/test/built-ins/DataView/prototype/setInt16/detached-buffer-after-toindex-byteoffset.js +++ b/test/built-ins/DataView/prototype/setInt16/detached-buffer-after-toindex-byteoffset.js @@ -28,7 +28,7 @@ var sample = new DataView(buffer, 0); $DETACHBUFFER(buffer); -assert.throws(TypeError, function() { +assert.throws(RangeError, function() { sample.setInt16(Infinity, 0); }, "Infinity"); diff --git a/test/built-ins/Date/prototype/setFullYear/new-value-time-clip.js b/test/built-ins/Date/prototype/setFullYear/new-value-time-clip.js index 83aa448f97..b3d73dd27f 100644 --- a/test/built-ins/Date/prototype/setFullYear/new-value-time-clip.js +++ b/test/built-ins/Date/prototype/setFullYear/new-value-time-clip.js @@ -44,6 +44,6 @@ assert.sameValue(returnValue, NaN, 'overflow due to month'); date = new Date(maxMs); -returnValue = date.setFullYear(maxYear, maxMonth, maxDate + 1); +returnValue = date.setFullYear(maxYear, maxMonth, maxDate + 2); assert.sameValue(returnValue, NaN, 'overflow due to date'); diff --git a/test/built-ins/Date/prototype/setMonth/new-value-time-clip.js b/test/built-ins/Date/prototype/setMonth/new-value-time-clip.js index 71e850544c..3ea6b8f90a 100644 --- a/test/built-ins/Date/prototype/setMonth/new-value-time-clip.js +++ b/test/built-ins/Date/prototype/setMonth/new-value-time-clip.js @@ -37,6 +37,6 @@ assert.sameValue(returnValue, NaN, 'overflow due to month'); date = new Date(maxMs); -returnValue = date.setMonth(maxMonth, maxDate + 1); +returnValue = date.setMonth(maxMonth, maxDate + 2); assert.sameValue(returnValue, NaN, 'overflow due to date'); diff --git a/test/built-ins/Function/internals/Construct/derived-this-uninitialized-realm.js b/test/built-ins/Function/internals/Construct/derived-this-uninitialized-realm.js index ad1a918e4f..c051a457db 100644 --- a/test/built-ins/Function/internals/Construct/derived-this-uninitialized-realm.js +++ b/test/built-ins/Function/internals/Construct/derived-this-uninitialized-realm.js @@ -19,9 +19,9 @@ features: [class] ---*/ var C = $.createRealm().global.eval( - 'class C extends Object {' + + '(class C extends Object {' + ' constructor() {}' + - '}' + '});' ); assert.throws(ReferenceError, function() { diff --git a/test/built-ins/global/global-object.js b/test/built-ins/global/global-object.js index 21be0f7692..d3efe5415c 100644 --- a/test/built-ins/global/global-object.js +++ b/test/built-ins/global/global-object.js @@ -22,5 +22,5 @@ assert.sameValue(Number, global.Number); assert.sameValue(RegExp, global.RegExp); assert.sameValue(String, global.String); -globalVariable = {}; +var globalVariable = {}; assert.sameValue(globalVariable, global.globalVariable); diff --git a/test/language/block-scope/syntax/redeclaration-in-block/attempt-to-redeclare-function-declaration-with-function-declaration.js b/test/language/block-scope/syntax/redeclaration-in-block/attempt-to-redeclare-function-declaration-with-function-declaration.js index df3332bc70..adedef2b9d 100644 --- a/test/language/block-scope/syntax/redeclaration-in-block/attempt-to-redeclare-function-declaration-with-function-declaration.js +++ b/test/language/block-scope/syntax/redeclaration-in-block/attempt-to-redeclare-function-declaration-with-function-declaration.js @@ -8,6 +8,7 @@ description: > negative: phase: early type: SyntaxError +flags: [onlyStrict] ---*/ { function f() {} function f() {} } diff --git a/test/language/expressions/async-generators/expression-yield-as-statement.js b/test/language/expressions/async-generators/expression-yield-as-statement.js index 9647c0bb39..f952461eac 100644 --- a/test/language/expressions/async-generators/expression-yield-as-statement.js +++ b/test/language/expressions/async-generators/expression-yield-as-statement.js @@ -19,7 +19,7 @@ iter1.next().then(function(result) { assert.sameValue( result.done, false, "Without right-hand-side: first result `done` flag"); }).then(undefined, $DONE); -iter1.next(function(result) { +iter1.next().then(function(result) { assert.sameValue( result.value, undefined, "Without right-hand-side: second result `value`"); assert.sameValue( @@ -33,7 +33,7 @@ iter2.next().then(function(result) { assert.sameValue( result.done, false, "With right-hand-side: first result `done` flag"); }).then(undefined, $DONE); -iter2.next(function(result) { +iter2.next().then(function(result) { assert.sameValue( result.value, undefined, "With right-hand-side: second result `value`"); assert.sameValue( diff --git a/test/language/module-code/namespace/internals/own-property-keys-binding-types.js b/test/language/module-code/namespace/internals/own-property-keys-binding-types.js index 3df54646b4..568ace3b70 100644 --- a/test/language/module-code/namespace/internals/own-property-keys-binding-types.js +++ b/test/language/module-code/namespace/internals/own-property-keys-binding-types.js @@ -53,7 +53,7 @@ assert( var allKeys = Reflect.ownKeys(ns); assert( - allKeys.length > 11, + allKeys.length >= 11, 'at least as many keys as defined by the module and the specification' ); assert.sameValue(allKeys[0], 'a_local1'); diff --git a/test/language/module-code/namespace/internals/own-property-keys-sort.js b/test/language/module-code/namespace/internals/own-property-keys-sort.js index 6eea98033e..22adb704b4 100644 --- a/test/language/module-code/namespace/internals/own-property-keys-sort.js +++ b/test/language/module-code/namespace/internals/own-property-keys-sort.js @@ -55,7 +55,7 @@ assert.sameValue(stringKeys[15], '\u03c0', 'stringKeys[15] === "\u03c0"'); var allKeys = Reflect.ownKeys(ns); assert( - allKeys.length > 17, + allKeys.length >= 17, 'at least as many keys as defined by the module and the specification' ); assert.sameValue(allKeys[0], '$', 'allKeys[0] === "$"'); diff --git a/test/language/module-code/namespace/internals/set-prototype-of-null.js b/test/language/module-code/namespace/internals/set-prototype-of-null.js index 405641cfc5..19e90f6b20 100644 --- a/test/language/module-code/namespace/internals/set-prototype-of-null.js +++ b/test/language/module-code/namespace/internals/set-prototype-of-null.js @@ -11,4 +11,4 @@ flags: [module] import * as ns from './set-prototype-of-null.js'; assert.sameValue(typeof Object.setPrototypeOf, 'function'); -assert.sameValue(ns, Object.setPrototypeOf(ns, null); +assert.sameValue(ns, Object.setPrototypeOf(ns, null)); diff --git a/test/language/statements/async-function/early-errors-no-async-generator.js b/test/language/statements/async-function/early-errors-no-async-generator.js deleted file mode 100644 index 9c4d2b4713..0000000000 --- a/test/language/statements/async-function/early-errors-no-async-generator.js +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright 2016 Microsoft, Inc. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -author: Brian Terlson <brian.terlson@microsoft.com> -esid: pending -description: > - Async generators are not a thing (yet) -negative: - phase: early - type: SyntaxError ----*/ - -async function* foo() { } -- GitLab