Bug 977849 - Sync test262. (r=evilpie)

--HG--
rename : js/src/tests/test262/built-ins/Date/UTC/nans.js => js/src/tests/test262/built-ins/Date/UTC/no-arg.js
rename : js/src/tests/test262/built-ins/Object/prototype/toString/symbol-tag-override.js => js/src/tests/test262/built-ins/Object/prototype/toString/symbol-tag-override-instances.js
extra : rebase_source : abd712d80a59758d251e54bad64a3c1f86cc17c2
This commit is contained in:
Shu-yu Guo 2017-02-09 15:25:25 -08:00
Родитель 8eac162b4c
Коммит fab3ade2de
101 изменённых файлов: 1805 добавлений и 76 удалений

Просмотреть файл

@ -722,6 +722,39 @@ skip script test262/annexB/language/eval-code/indirect/global-if-decl-else-decl-
skip script test262/annexB/language/eval-code/indirect/global-block-decl-eval-global-exsting-global-init.js
skip script test262/annexB/language/eval-code/indirect/global-switch-case-eval-global-exsting-global-init.js
# https://bugzilla.mozilla.org/show_bug.cgi?id=1331092
skip script test262/language/expressions/async-generators/expression-yield-as-statement.js
skip script test262/language/expressions/async-generators/expression-await-thenable-as-yield-operand.js
skip script test262/language/expressions/async-generators/expression-yield-as-operand.js
skip script test262/language/expressions/async-generators/expression-await-as-yield-operand.js
skip script test262/language/expressions/async-generators/expression-yield-newline.js
skip script test262/language/expressions/async-generators/expression-await-promise-as-yield-operand.js
skip script test262/language/expressions/async-generators/expression-yield-star-before-newline.js
# https://bugzilla.mozilla.org/show_bug.cgi?id=1050755
skip script test262/built-ins/Date/UTC/return-value.js
# PluralRules.
skip script test262/intl402/PluralRules/builtin.js
skip script test262/intl402/PluralRules/this-not-ignored.js
skip script test262/intl402/PluralRules/name.js
skip script test262/intl402/PluralRules/length.js
skip script test262/intl402/PluralRules/supportedLocalesOf/main.js
skip script test262/intl402/PluralRules/can-be-subclassed.js
skip script test262/intl402/PluralRules/internals.js
skip script test262/intl402/PluralRules/prototype/properties.js
skip script test262/intl402/PluralRules/supportedLocalesOf/supportedLocalesOf.js
skip script test262/intl402/PluralRules/supportedLocalesOf/name.js
skip script test262/intl402/PluralRules/supportedLocalesOf/arguments.js
skip script test262/intl402/PluralRules/prototype/builtins.js
skip script test262/intl402/PluralRules/prototype/prototype.js
skip script test262/intl402/PluralRules/prototype/bind.js
skip script test262/intl402/PluralRules/prototype/resolvedOptions/name.js
skip script test262/intl402/PluralRules/prototype/resolvedOptions/properties.js
skip script test262/intl402/PluralRules/prototype/resolvedOptions/builtins.js
skip script test262/intl402/PluralRules/prototype/constructor/main.js
skip script test262/intl402/PluralRules/prototype/select/name.js
# SIMD.
skip script test262/built-ins/Simd/check.js
skip script test262/built-ins/Simd/from.js

Просмотреть файл

@ -1,8 +1,5 @@
commit 4ff7e4342e1a15ce7af893ba9af9bd55c7d95e51
Author: Adam Klein <adamk@chromium.org>
Date: Wed Dec 28 17:18:19 2016 -0800
commit 8a0563dd5eb9c6ee1df8a17cf8f626c35fa56a46
Author: Corey Frang <gnarf@gnarf.net>
Date: Tue Jan 31 10:50:39 2017 -0500
Fix test for instantiating a class extending null (#813)
The sameValue assertion should be that the [[Prototype]] is
equal to the class's prototype, not the constructor.
Remove old test file (now using the named version)

Просмотреть файл

@ -0,0 +1,15 @@
// Copyright 2017 Lyza Danger Gardner. All rights reserved.
// This code is governed by the license found in the LICENSE file.
/*---
description: Testing descriptor property of Array.isArray
includes:
- propertyHelper.js
esid: sec-array.isarray
---*/
verifyWritable(Array, "isArray");
verifyNotEnumerable(Array, "isArray");
verifyConfigurable(Array, "isArray");
reportCompare(0, 0);

Просмотреть файл

@ -1,11 +0,0 @@
// Copyright (c) 2012 Ecma International. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es5id: 15.4.4.16-0-2
description: Array.prototype.every.length must be 1
---*/
assert.sameValue(Array.prototype.every.length, 1, 'Array.prototype.every.length');
reportCompare(0, 0);

23
js/src/tests/test262/built-ins/Array/prototype/every/length.js поставляемый Normal file
Просмотреть файл

@ -0,0 +1,23 @@
// Copyright (c) 2012 Ecma International. All rights reserved.
// Copyright (C) 2017 Corey Frang. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-array.prototype.every
description: >
Array.prototype.every.length value and property descriptor
info: >
Array.prototype.every ( callbackfn [ , thisArg] )
The length property of the of function is 1.
includes: [propertyHelper.js]
---*/
assert.sameValue(
Array.prototype.every.length, 1,
'The value of `Array.prototype.every.length` is `1`'
);
verifyNotEnumerable(Array.prototype.every, 'length');
verifyNotWritable(Array.prototype.every, 'length');
verifyConfigurable(Array.prototype.every, 'length');
reportCompare(0, 0);

Просмотреть файл

@ -1,44 +1,3 @@
<<<<<<< HEAD
// Copyright (C) 2015 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es6id: 24.1.2.1
description: >
The new ArrayBuffer instance is created prior to allocating the Data Block.
info: >
ArrayBuffer( length )
...
6. Return AllocateArrayBuffer(NewTarget, byteLength).
AllocateArrayBuffer( constructor, byteLength )
1. Let obj be OrdinaryCreateFromConstructor(constructor, "%ArrayBufferPrototype%",
«[[ArrayBufferData]], [[ArrayBufferByteLength]]» ).
2. ReturnIfAbrupt(obj).
...
4. Let block be CreateByteDataBlock(byteLength).
5. ReturnIfAbrupt(block).
...
features: [Reflect.construct]
---*/
function DummyError() { }
var newTarget = function(){}.bind(null);
Object.defineProperty(newTarget, "prototype", {
get: function() {
throw new DummyError();
}
});
assert.throws(DummyError, function() {
// Allocating 7 PiB should fail with a RangeError.
// Math.pow(1024, 5) = 1125899906842624
Reflect.construct(ArrayBuffer, [7 * 1125899906842624], newTarget);
});
||||||| parent of f70a7f3... p3
=======
// Copyright (C) 2015 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
@ -79,4 +38,3 @@ assert.throws(DummyError, function() {
});
reportCompare(0, 0);
>>>>>>> f70a7f3... p3

Просмотреть файл

@ -6,7 +6,7 @@ es6id: 20.3.3.4
description: Infinite values specified to MakeDay produce NaN
info: |
[...]
9. Return TimeClip(MakeDate(MakeDay(yr, m, dt), MakeTime(h, min, s, milli))).
9. Return TimeClip(MakeDate(MakeDay(yr, m, dt), MakeTime(h, min, s, milli))).
MakeDay (year, month, date)
@ -14,6 +14,9 @@ info: |
NaN.
---*/
assert.sameValue(Date.UTC(Infinity), NaN, 'year: Infinity - single arg');
assert.sameValue(Date.UTC(-Infinity), NaN, 'year: -Infinity - single arg');
assert.sameValue(Date.UTC(Infinity, 0), NaN, 'year: Infinity');
assert.sameValue(Date.UTC(-Infinity, 0), NaN, 'year: -Infinity');
@ -23,4 +26,5 @@ assert.sameValue(Date.UTC(0, -Infinity), NaN, 'month: -Infinity');
assert.sameValue(Date.UTC(0, 0, Infinity), NaN, 'date: Infinity');
assert.sameValue(Date.UTC(0, 0, -Infinity), NaN, 'date: -Infinity');
reportCompare(0, 0);

Просмотреть файл

@ -14,15 +14,16 @@ info: |
7. If ms is supplied, let milli be ? ToNumber(ms); else let milli be 0.
8. If y is not NaN and 0 ToInteger(y) 99, let yr be 1900+ToInteger(y);
otherwise, let yr be y.
9. Return TimeClip(MakeDate(MakeDay(yr, m, dt), MakeTime(h, min, s, milli))).
9. Return TimeClip(MakeDate(MakeDay(yr, m, dt), MakeTime(h, min, s, milli))).
---*/
assert.sameValue(new Date(NaN, 0).getTime(), NaN, 'year');
assert.sameValue(new Date(1970, NaN).getTime(), NaN, 'month');
assert.sameValue(new Date(1970, 0, NaN).getTime(), NaN, 'date');
assert.sameValue(new Date(1970, 0, 1, NaN).getTime(), NaN, 'hours');
assert.sameValue(new Date(1970, 0, 1, 0, NaN).getTime(), NaN, 'minutes');
assert.sameValue(new Date(1970, 0, 1, 0, 0, NaN).getTime(), NaN, 'seconds');
assert.sameValue(new Date(1970, 0, 1, 0, 0, 0, NaN).getTime(), NaN, 'ms');
assert.sameValue(Date.UTC(NaN), NaN, 'year');
assert.sameValue(Date.UTC(NaN, 0), NaN, 'year');
assert.sameValue(Date.UTC(1970, NaN), NaN, 'month');
assert.sameValue(Date.UTC(1970, 0, NaN), NaN, 'date');
assert.sameValue(Date.UTC(1970, 0, 1, NaN), NaN, 'hours');
assert.sameValue(Date.UTC(1970, 0, 1, 0, NaN), NaN, 'minutes');
assert.sameValue(Date.UTC(1970, 0, 1, 0, 0, NaN), NaN, 'seconds');
assert.sameValue(Date.UTC(1970, 0, 1, 0, 0, 0, NaN), NaN, 'ms');
reportCompare(0, 0);

Просмотреть файл

@ -0,0 +1,22 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-date.utc
es6id: 20.3.3.4
description: Tests for non optional arguments
info: |
1. Let y be ? ToNumber(year).
2. Let m be ? ToNumber(month).
3. If date is supplied, let dt be ? ToNumber(date); else let dt be 1.
4. If hours is supplied, let h be ? ToNumber(hours); else let h be 0.
5. If minutes is supplied, let min be ? ToNumber(minutes); else let min be 0.
6. If seconds is supplied, let s be ? ToNumber(seconds); else let s be 0.
7. If ms is supplied, let milli be ? ToNumber(ms); else let milli be 0.
8. If y is not NaN and 0 ToInteger(y) 99, let yr be 1900+ToInteger(y);
otherwise, let yr be y.
9. Return TimeClip(MakeDate(MakeDay(yr, m, dt), MakeTime(h, min, s, milli))).
---*/
assert.sameValue(Date.UTC(), NaN, 'missing non-optional year argument');
reportCompare(0, 0);

Просмотреть файл

@ -14,9 +14,11 @@ info: |
7. If ms is supplied, let milli be ? ToNumber(ms); else let milli be 0.
8. If y is not NaN and 0 ToInteger(y) 99, let yr be 1900+ToInteger(y);
otherwise, let yr be y.
9. Return TimeClip(MakeDate(MakeDay(yr, m, dt), MakeTime(h, min, s, milli))).
9. Return TimeClip(MakeDate(MakeDay(yr, m, dt), MakeTime(h, min, s, milli))).
---*/
assert.sameValue(Date.UTC(1970), 0, '1970');
assert.sameValue(Date.UTC(1970, 0), 0, '1970, 0');
assert.sameValue(Date.UTC(2016, 0), 1451606400000, '2016, 0');
assert.sameValue(Date.UTC(2016, 6), 1467331200000, '2016, 6');

Просмотреть файл

@ -5,7 +5,7 @@
esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
description: Function.prototype.toString line terminator normalisation (CR-LF)
info: >
Function.prototype.toString should normalise line terminator sequences to Line Feed characters.
Function.prototype.toString should not normalise line terminator sequences to Line Feed characters.
This file uses (Carriage Return, Line Feed) sequences as line terminators.
---*/
@ -33,6 +33,6 @@ y
}
// after
assert.sameValue(f.toString(), "function\n// a\nf\n// b\n(\n// c\nx\n// d\n,\n// e\ny\n// f\n)\n// g\n{\n// h\n;\n// i\n;\n// j\n}");
assert.sameValue(f.toString(), "function\r\n// a\r\nf\r\n// b\r\n(\r\n// c\r\nx\r\n// d\r\n,\r\n// e\r\ny\r\n// f\r\n)\r\n// g\r\n{\r\n// h\r\n;\r\n// i\r\n;\r\n// j\r\n}");
reportCompare(0, 0);

Просмотреть файл

@ -1,2 +1,3 @@
// Copyright (C) 2016 Michael Ficarra. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. /*--- esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject description: Function.prototype.toString line terminator normalisation (CR) info: > Function.prototype.toString should normalise line terminator sequences to Line Feed characters. This file uses Carriage Return characters as line terminators. ---*/ // before function // a f // b ( // c x // d , // e y // f ) // g { // h ; // i ; // j } // after assert.sameValue(f.toString(), "function\n// a\nf\n// b\n(\n// c\nx\n// d\n,\n// e\ny\n// f\n)\n// g\n{\n// h\n;\n// i\n;\n// j\n}");
// Copyright (C) 2016 Michael Ficarra. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. /*--- esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject description: Function.prototype.toString line terminator normalisation (CR) info: > Function.prototype.toString should not normalise line terminator sequences to Line Feed characters. This file uses Carriage Return characters as line terminators. ---*/ // before function // a f // b ( // c x // d , // e y // f ) // g { // h ; // i ; // j } // after assert.sameValue(f.toString(), "function\r// a\rf\r// b\r(\r// c\rx\r// d\r,\r// e\ry\r// f\r)\r// g\r{\r// h\r;\r// i\r;\r// j\r}");
reportCompare(0, 0);

Просмотреть файл

@ -5,7 +5,7 @@
esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
description: Function.prototype.toString line terminator normalisation (LF)
info: >
Function.prototype.toString should normalise line terminator sequences to Line Feed characters.
Function.prototype.toString should not normalise line terminator sequences to Line Feed characters.
This file uses Line Feed characters as line terminators.
---*/

Просмотреть файл

@ -0,0 +1,32 @@
// Copyright (C) 2017 Michael "Z" Goddard. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-number.prototype.tofixed
es6id: 20.1.3.3
description: >
Number.prototype.toFixed.length is 1.
info: >
Number.prototype.toFixed ( fractionDigits )
17 ECMAScript Standard Built-in Objects:
Every built-in Function object, including constructors, has a length
property whose value is an integer. Unless otherwise specified, this
value is equal to the largest number of named arguments shown in the
subclause headings for the function description, including optional
parameters. However, rest parameters shown using the form ...name
are not included in the default argument count.
Unless otherwise specified, the length property of a built-in Function
object has the attributes { [[Writable]]: false, [[Enumerable]]: false,
[[Configurable]]: true }.
includes: [propertyHelper.js]
---*/
assert.sameValue(Number.prototype.toFixed.length, 1);
verifyNotEnumerable(Number.prototype.toFixed, "length");
verifyNotWritable(Number.prototype.toFixed, "length");
verifyConfigurable(Number.prototype.toFixed, "length");
reportCompare(0, 0);

Просмотреть файл

@ -0,0 +1,12 @@
// Copyright (C) 2017 K. Adam White. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-number.prototype.tofixed
description: >
Number.prototype.toFixed returns a string value
---*/
assert.sameValue(typeof (123.456).toFixed(), "string");
reportCompare(0, 0);

Просмотреть файл

@ -0,0 +1,44 @@
// Copyright (C) 2017 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
description: >
String values of `Symbol.toStringTag` property override built-in tags
es6id: 19.1.3.6
info: >
1. If the this value is undefined, return "[object Undefined]".
2. If the this value is null, return "[object Null]".
14. Else, let builtinTag be "Object".
15. Let tag be ? Get(O, @@toStringTag).
16. If Type(tag) is not String, let tag be builtinTag.
17. Return the String that is the result of concatenating "[object ", tag, and "]".
4.3.2 primitive value
member of one of the types Undefined, Null, Boolean, Number, Symbol, or String as defined in clause 6
features: [Symbol.toStringTag]
---*/
Boolean.prototype[Symbol.toStringTag] = 'test262';
assert.sameValue(Object.prototype.toString.call(Boolean.prototype), '[object test262]');
assert.sameValue(Object.prototype.toString.call(true), '[object test262]');
Number.prototype[Symbol.toStringTag] = 'test262';
assert.sameValue(Object.prototype.toString.call(Number.prototype), '[object test262]');
assert.sameValue(Object.prototype.toString.call(0), '[object test262]');
String.prototype[Symbol.toStringTag] = 'test262';
assert.sameValue(Object.prototype.toString.call(String.prototype), '[object test262]');
assert.sameValue(Object.prototype.toString.call(''), '[object test262]');
Object.defineProperty(Symbol.prototype, Symbol.toStringTag, {
value: 'test262'
});
assert.sameValue(Object.prototype.toString.call(Symbol.prototype), '[object test262]');
reportCompare(0, 0);

Просмотреть файл

@ -19,7 +19,9 @@ var invalidLanguageTags = [
"i_klingon",
"cmn-hans-cn-t-ca-u-ca-x_t-u",
"enochian_enochian",
"de-gregory_u-ca-gregory"
"de-gregory_u-ca-gregory",
"de-tester-Tester", // Case-insensitive duplicate variant subtag
"de-DE-u-kn-true-U-kn-true", // Case-insensitive duplicate singleton subtag
];
testWithIntlConstructors(function (Constructor) {

Просмотреть файл

@ -37,7 +37,6 @@ var currencyDigits = {
BSD: 2,
BTN: 2,
BWP: 2,
BYR: 0,
BZD: 2,
CAD: 2,
CDF: 2,

Просмотреть файл

Просмотреть файл

@ -0,0 +1,17 @@
// |reftest| skip-if(!this.hasOwnProperty('Intl')) -- needs Intl
// Copyright 2016 Mozilla Corporation. All rights reserved.
// This code is governed by the license found in the LICENSE file.
/*---
esid: sec-Intl.PluralRules
description: >
Tests that Intl.PluralRules meets the requirements for
built-in objects defined by the introduction of chapter 17 of the
ECMAScript Language Specification.
author: Zibi Braniecki
includes: [testBuiltInObject.js]
---*/
testBuiltInObject(Intl.PluralRules, true, true, ["supportedLocalesOf"], 0);
reportCompare(0, 0);

Просмотреть файл

@ -0,0 +1,31 @@
// |reftest| skip-if(!this.hasOwnProperty('Intl')) -- needs Intl
// Copyright 2016 Mozilla Corporation. All rights reserved.
// This code is governed by the license found in the LICENSE file.
/*---
esid: sec-intl-pluralrules-constructor
description: Tests that Intl.PluralRules can be subclassed.
author: Zibi Braniecki
includes: [testIntl.js]
---*/
// get a plural-rules and have it format an array of dates for comparison with the subclass
var locales = ["tlh", "id", "en"];
var a = [1, 5, 12];
var referencePluralRules = new Intl.PluralRules(locales);
var referenceSelected = a.map(referencePluralRules.select.bind(referencePluralRules));
class MyPluralRules extends Intl.PluralRules {
constructor(locales, options) {
super(locales, options);
// could initialize MyPluralRules properties
}
// could add methods to MyPluralRules.prototype
}
var pr = new MyPluralRules(locales);
var actual = a.map(pr.select.bind(pr));
testArraysAreSame(referenceSelected, actual);
reportCompare(0, 0);

Просмотреть файл

@ -0,0 +1,24 @@
// |reftest| skip-if(!this.hasOwnProperty('Intl')) -- needs Intl
// Copyright 2016 Mozilla Corporation. All rights reserved.
// This code is governed by the license found in the LICENSE file.
/*---
esid: sec-intl-pluralrules-constructor
description: >
Tests that objects constructed by Intl.PluralRules have the specified
internal properties.
author: Zibi Braniecki
---*/
var obj = new Intl.PluralRules();
var actualPrototype = Object.getPrototypeOf(obj);
if (actualPrototype !== Intl.PluralRules.prototype) {
$ERROR("Prototype of object constructed by Intl.PluralRules isn't Intl.PluralRules.prototype; got " + actualPrototype);
}
if (!Object.isExtensible(obj)) {
$ERROR("Object constructed by Intl.PluralRules must be extensible.");
}
reportCompare(0, 0);

Просмотреть файл

@ -0,0 +1,18 @@
// |reftest| skip-if(!this.hasOwnProperty('Intl')) -- needs Intl
// Copyright 2016 Mozilla Corporation. All rights reserved.
// This code is governed by the license found in the LICENSE file.
/*---
esid: sec-Intl.PluralRules
description: Intl.PluralRules.length.
author: Zibi Braniecki
includes: [propertyHelper.js]
---*/
assert.sameValue(Intl.PluralRules.length, 0);
verifyNotEnumerable(Intl.PluralRules, "length");
verifyNotWritable(Intl.PluralRules, "length");
verifyConfigurable(Intl.PluralRules, "length");
reportCompare(0, 0);

Просмотреть файл

@ -0,0 +1,18 @@
// |reftest| skip-if(!this.hasOwnProperty('Intl')) -- needs Intl
// Copyright 2016 Mozilla Corporation. All rights reserved.
// This code is governed by the license found in the LICENSE file.
/*---
esid: sec-Intl.PluralRules
description: Intl.PluralRules.name is "PluralRules"
author: Zibi Braniecki
includes: [propertyHelper.js]
---*/
assert.sameValue(Intl.PluralRules.name, "PluralRules");
verifyNotEnumerable(Intl.PluralRules, "name");
verifyNotWritable(Intl.PluralRules, "name");
verifyConfigurable(Intl.PluralRules, "name");
reportCompare(0, 0);

37
js/src/tests/test262/intl402/PluralRules/prototype/bind.js поставляемый Normal file
Просмотреть файл

@ -0,0 +1,37 @@
// |reftest| skip-if(!this.hasOwnProperty('Intl')) -- needs Intl
// Copyright 2016 Mozilla Corporation. All rights reserved.
// This code is governed by the license found in the LICENSE file.
/*---
esid: sec-properties-of-intl-pluralrules-prototype-object
description: >
Tests that Intl.PluralRules.prototype functions throw a TypeError if
called on a non-object value or an object that hasn't been
initialized as a PluralRules.
author: Zibi Braniecki
---*/
var functions = {
select: Intl.PluralRules.prototype.select,
resolvedOptions: Intl.PluralRules.prototype.resolvedOptions
};
var invalidTargets = [undefined, null, true, 0, "PluralRules", [], {}];
Object.getOwnPropertyNames(functions).forEach(function (functionName) {
var f = functions[functionName];
invalidTargets.forEach(function (target) {
var error;
try {
f.call(target);
} catch (e) {
error = e;
}
if (error === undefined) {
$ERROR("Calling " + functionName + " on " + target + " was not rejected.");
} else if (error.name !== "TypeError") {
$ERROR("Calling " + functionName + " on " + target + " was rejected with wrong error " + error.name + ".");
}
});
});
reportCompare(0, 0);

0
js/src/tests/test262/intl402/PluralRules/prototype/browser.js поставляемый Normal file
Просмотреть файл

17
js/src/tests/test262/intl402/PluralRules/prototype/builtins.js поставляемый Normal file
Просмотреть файл

@ -0,0 +1,17 @@
// |reftest| skip-if(!this.hasOwnProperty('Intl')) -- needs Intl
// Copyright 2016 Mozilla Corporation. All rights reserved.
// This code is governed by the license found in the LICENSE file.
/*---
esid: sec-properties-of-intl-pluralrules-prototype-object
description: >
Tests that Intl.PluralRules.prototype meets the requirements for
built-in objects defined by the introduction of chapter 17 of the
ECMAScript Language Specification.
author: Zibi Braniecki
includes: [testBuiltInObject.js]
---*/
testBuiltInObject(Intl.PluralRules.prototype, false, false, ["constructor", "select", "resolvedOptions"]);
reportCompare(0, 0);

Просмотреть файл

Просмотреть файл

@ -0,0 +1,18 @@
// |reftest| skip-if(!this.hasOwnProperty('Intl')) -- needs Intl
// Copyright 2016 Mozilla Corporation. All rights reserved.
// This code is governed by the license found in the LICENSE file.
/*---
esid: sec-Intl.PluralRules.prototype.constructor
description: >
Tests that Intl.PluralRules.prototype is an object that has been
initialized as an Intl.PluralRules.
author: Zibi Braniecki
---*/
if (Intl.PluralRules.prototype.constructor !== Intl.PluralRules) {
$ERROR("Intl.PluralRules.prototype.constructor is not the same as " +
"Intl.PluralRules");
}
reportCompare(0, 0);

Просмотреть файл

Просмотреть файл

@ -0,0 +1,25 @@
// |reftest| skip-if(!this.hasOwnProperty('Intl')) -- needs Intl
// Copyright 2016 Mozilla Corporation. All rights reserved.
// This code is governed by the license found in the LICENSE file.
/*---
esid: sec-properties-of-intl-pluralrules-prototype-object
description: Tests that Intl.PluralRules.prototype has the required attributes.
author: Zibi Braniecki
---*/
var desc = Object.getOwnPropertyDescriptor(Intl.PluralRules, "prototype");
if (desc === undefined) {
$ERROR("Intl.PluralRules.prototype is not defined.");
}
if (desc.writable) {
$ERROR("Intl.PluralRules.prototype must not be writable.");
}
if (desc.enumerable) {
$ERROR("Intl.PluralRules.prototype must not be enumerable.");
}
if (desc.configurable) {
$ERROR("Intl.PluralRules.prototype must not be configurable.");
}
reportCompare(0, 0);

20
js/src/tests/test262/intl402/PluralRules/prototype/prototype.js поставляемый Normal file
Просмотреть файл

@ -0,0 +1,20 @@
// |reftest| skip-if(!this.hasOwnProperty('Intl')) -- needs Intl
// Copyright 2016 Mozilla Corporation. All rights reserved.
// This code is governed by the license found in the LICENSE file.
/*---
esid: sec-properties-of-intl-pluralrules-prototype-object
description: >
Tests that Intl.PluralRules.prototype is an object that has been
initialized as an Intl.PluralRules.
author: Zibi Braniecki
---*/
// test by calling a function that would fail if "this" were not an object
// initialized as an Intl.PluralRules
if (typeof Intl.PluralRules.prototype.select(0) !== "string") {
$ERROR("Intl.PluralRules's prototype is not an object that has been " +
"initialized as an Intl.PluralRules");
}
reportCompare(0, 0);

Просмотреть файл

Просмотреть файл

@ -0,0 +1,17 @@
// |reftest| skip-if(!this.hasOwnProperty('Intl')) -- needs Intl
// Copyright 2016 Mozilla Corporation. All rights reserved.
// This code is governed by the license found in the LICENSE file.
/*---
esid: sec-Intl.PluralRules.prototype.resolvedOptions
description: >
Tests that Intl.PluralRules.prototype.resolvedOptions meets the requirements for
built-in objects defined by the introduction of chapter 17 of the
ECMAScript Language Specification.
author: Zibi Braniecki
includes: [testBuiltInObject.js]
---*/
testBuiltInObject(Intl.PluralRules.prototype.resolvedOptions, true, false, [], 0);
reportCompare(0, 0);

Просмотреть файл

@ -0,0 +1,18 @@
// |reftest| skip-if(!this.hasOwnProperty('Intl')) -- needs Intl
// Copyright 2016 Mozilla Corporation. All rights reserved.
// This code is governed by the license found in the LICENSE file.
/*---
esid: sec-Intl.PluralRules.resolvedOptions.name
description: Intl.PluralRules.resolvedOptions.name is "resolvedOptions"
author: Zibi Braniecki
includes: [propertyHelper.js]
---*/
assert.sameValue(Intl.PluralRules.prototype.resolvedOptions.name, "resolvedOptions");
verifyNotEnumerable(Intl.PluralRules.prototype.resolvedOptions, "name");
verifyNotWritable(Intl.PluralRules.prototype.resolvedOptions, "name");
verifyConfigurable(Intl.PluralRules.prototype.resolvedOptions, "name");
reportCompare(0, 0);

Просмотреть файл

@ -0,0 +1,33 @@
// |reftest| skip-if(!this.hasOwnProperty('Intl')) -- needs Intl
// Copyright 2016 Mozilla Corporation. All rights reserved.
// This code is governed by the license found in the LICENSE file.
/*---
esid: sec-Intl.PluralRules.prototype.resolvedOptions
description: >
Tests that the object returned by
Intl.PluralRules.prototype.resolvedOptions has the right
properties.
author: Zibi Braniecki
includes: [testIntl.js]
---*/
var actual = new Intl.PluralRules().resolvedOptions();
var actual2 = new Intl.PluralRules().resolvedOptions();
if (actual2 === actual) {
$ERROR("resolvedOptions returned the same object twice.");
}
// this assumes the default values where the specification provides them
mustHaveProperty(actual, "locale", isCanonicalizedStructurallyValidLanguageTag);
mustHaveProperty(actual, "type", ["cardinal"]);
mustNotHaveProperty(actual, "currency");
mustNotHaveProperty(actual, "currencyDisplay");
mustHaveProperty(actual, "minimumIntegerDigits", [1]);
mustHaveProperty(actual, "minimumFractionDigits", [0]);
mustHaveProperty(actual, "maximumFractionDigits", [3]);
mustNotHaveProperty(actual, "minimumSignificantDigits");
mustNotHaveProperty(actual, "maximumSignificantDigits");
reportCompare(0, 0);

Просмотреть файл

Просмотреть файл

Просмотреть файл

@ -0,0 +1,20 @@
// |reftest| skip-if(!this.hasOwnProperty('Intl')) -- needs Intl
// Copyright 2016 Mozilla Corporation. All rights reserved.
// This code is governed by the license found in the LICENSE file.
/*---
esid: sec-Intl.PluralRules.prototype.select
description: Intl.PluralRules.prototype.select.name is "select"
author: Zibi Braniecki
includes: [propertyHelper.js]
---*/
assert.sameValue(Intl.PluralRules.prototype.select.name, 'select',
'The value of `Intl.PluralRules.prototype.select.name` is `"select"`'
);
verifyNotEnumerable(Intl.PluralRules.prototype.select, 'name');
verifyNotWritable(Intl.PluralRules.prototype.select, 'name');
verifyConfigurable(Intl.PluralRules.prototype.select, 'name');
reportCompare(0, 0);

Просмотреть файл

@ -0,0 +1,25 @@
// |reftest| skip -- has YAML errors
// Copyright 2016 Mozilla Corporation. All rights reserved.
// This code is governed by the license found in the LICENSE file.
/*---
esid: sec-Intl.PluralRules.prototype.select
description: Tests that select function returns "other" for non finite values.
info:
1.1.4. ResolvePlural (pluralRules, n)
(...)
1.1.4_3. If isFinite(n) is false, then
1.1.4_3.a. Return "other".
author: Zibi Braniecki
---*/
var invalidValues = [NaN, Infinity, -Infinity];
var pr = new Intl.PluralRules();
invalidValues.forEach(function (value) {
assert.sameValue(pr.select(value), "other");
});
reportCompare(0, 0);

Просмотреть файл

Просмотреть файл

@ -0,0 +1,23 @@
// |reftest| skip -- has YAML errors
// Copyright 2016 Mozilla Corporation. All rights reserved.
// This code is governed by the license found in the LICENSE file.
/*---
esid: sec-intl-pluralrules-abstracts
description: >
Tests that the behavior of a Record is not affected by
adversarial changes to Object.prototype.
info:
1.1.1. InitializePluralRules (pluralRules, locales, options)
(...)
1.1.1_6. Let t be ? GetOption(options, "type", "string", « "cardinal", "ordinal" », "cardinal").
author: Zibi Braniecki
includes: [testIntl.js]
---*/
taintProperties(["type"]);
var pr = new Intl.PluralRules();
var time = pr.select(9);
reportCompare(0, 0);

0
js/src/tests/test262/intl402/PluralRules/prototype/shell.js поставляемый Normal file
Просмотреть файл

Просмотреть файл

Просмотреть файл

@ -0,0 +1,17 @@
// |reftest| skip-if(!this.hasOwnProperty('Intl')) -- needs Intl
// Copyright 2016 Mozilla Corporation. All rights reserved.
// This code is governed by the license found in the LICENSE file.
/*---
esid: sec-Intl.PluralRules.supportedLocalesOf
description: >
Tests that Intl.PluralRules.supportedLocalesOf doesn't access
arguments that it's not given.
author: Zibi Braniecki
includes: [testIntl.js]
---*/
taintDataProperty(Object.prototype, "1");
new Intl.PluralRules("und");
reportCompare(0, 0);

Просмотреть файл

Просмотреть файл

@ -0,0 +1,32 @@
// |reftest| skip-if(!this.hasOwnProperty('Intl')) -- needs Intl
// Copyright 2016 Mozilla Corporation. All rights reserved.
// This code is governed by the license found in the LICENSE file.
/*---
esid: sec-Intl.PluralRules.supportedLocalesOf
description: >
Tests that Intl.PluralRules has a supportedLocalesOf property, and
it works as planned.
author: Zibi Braniecki
---*/
var defaultLocale = new Intl.PluralRules().resolvedOptions().locale;
var notSupported = 'zxx'; // "no linguistic content"
var requestedLocales = [defaultLocale, notSupported];
var supportedLocales;
if (!Intl.PluralRules.hasOwnProperty('supportedLocalesOf')) {
$ERROR("Intl.PluralRules doesn't have a supportedLocalesOf property.");
}
supportedLocales = Intl.PluralRules.supportedLocalesOf(requestedLocales);
if (supportedLocales.length !== 1) {
$ERROR('The length of supported locales list is not 1.');
}
if (supportedLocales[0] !== defaultLocale) {
$ERROR('The default locale is not returned in the supported list.');
}
reportCompare(0, 0);

Просмотреть файл

@ -0,0 +1,17 @@
// |reftest| skip-if(!this.hasOwnProperty('Intl')) -- needs Intl
// Copyright 2016 Mozilla Corporation. All rights reserved.
// This code is governed by the license found in the LICENSE file.
/*---
esid: sec-Intl.PluralRules.supportedLocalesOf
description: Tests that Intl.PluralRules.supportedLocalesOf.name is "supportedLocalesOf"
author: Zibi Braniecki
includes: [propertyHelper.js]
---*/
assert.sameValue(Intl.PluralRules.supportedLocalesOf.name, "supportedLocalesOf");
verifyNotEnumerable(Intl.PluralRules.supportedLocalesOf, "name");
verifyNotWritable(Intl.PluralRules.supportedLocalesOf, "name");
verifyConfigurable(Intl.PluralRules.supportedLocalesOf, "name");
reportCompare(0, 0);

Просмотреть файл

Просмотреть файл

@ -0,0 +1,17 @@
// |reftest| skip-if(!this.hasOwnProperty('Intl')) -- needs Intl
// Copyright 2016 Mozilla Corporation. All rights reserved.
// This code is governed by the license found in the LICENSE file.
/*---
esid: sec-Intl.PluralRules.supportedLocalesOf
description: >
Tests that Intl.PluralRules.supportedLocalesOf meets the requirements for
built-in objects defined by the introduction of chapter 17 of the
ECMAScript Language Specification.
author: Zibi Braniecki
includes: [testBuiltInObject.js]
---*/
testBuiltInObject(Intl.PluralRules.supportedLocalesOf, true, false, [], 1);
reportCompare(0, 0);

Просмотреть файл

@ -0,0 +1,32 @@
// |reftest| skip-if(!this.hasOwnProperty('Intl')) -- needs Intl
// Copyright 2016 Mozilla Corporation. All rights reserved.
// This code is governed by the license found in the LICENSE file.
/*---
esid: sec-Intl.PluralRules
description: Tests that the this-value is ignored in PluralRules
author: Zibi Braniecki
includes: [testIntl.js]
---*/
testWithIntlConstructors(function (Constructor) {
var obj, newObj;
// variant 1: use constructor in a "new" expression
obj = new Constructor();
newObj = Intl.PluralRules.call(obj);
if (obj === newObj) {
$ERROR("PluralRules object created with \"new\" was not ignored as this-value.");
}
// variant 2: use constructor as a function
obj = Constructor();
newObj = Intl.PluralRules.call(obj);
if (obj === newObj) {
$ERROR("PluralRules object created with constructor as function was not ignored as this-value.");
}
return true;
});
reportCompare(0, 0);

Просмотреть файл

@ -0,0 +1,24 @@
// Copyright (C) 2017 Caio Lima. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
description: Mapped arguments object with non-configurable property property descriptor behavior
info: >
Descriptor of a mapped value is updated when property is made non-configurable.
flags: [noStrict]
esid: sec-arguments-exotic-objects-defineownproperty-p-desc
includes: [propertyHelper.js]
---*/
function argumentsNonConfigurable(a) {
Object.defineProperty(arguments, "0", {configurable: false});
let propertyDescriptor = Object.getOwnPropertyDescriptor(arguments, "0");
assert.sameValue(propertyDescriptor.value, 1);
verifyEnumerable(arguments, "0");
verifyWritable(arguments, "0");
verifyNotConfigurable(arguments, "0");
}
argumentsNonConfigurable(1);
reportCompare(0, 0);

Просмотреть файл

@ -0,0 +1,29 @@
// Copyright (C) 2017 Caio Lima. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
description: Mapped arguments property descriptor change with non-configurable property
info: >
Mapping keep working when property is set to non-configurable and its
value is changed using arguments[i] where "i" is the argument index.
flags: [noStrict]
esid: sec-arguments-exotic-objects-defineownproperty-p-desc
includes: [propertyHelper.js]
---*/
function argumentsAndSetByIndex(a) {
Object.defineProperty(arguments, "0", {configurable: false});
arguments[0] = 2;
let propertyDescriptor = Object.getOwnPropertyDescriptor(arguments, "0");
assert.sameValue(propertyDescriptor.value, 2);
assert.sameValue(a, 2);
verifyEnumerable(arguments, "0");
verifyWritable(arguments, "0");
verifyNotConfigurable(arguments, "0");
}
argumentsAndSetByIndex(1);
reportCompare(0, 0);

Просмотреть файл

@ -0,0 +1,29 @@
// Copyright (C) 2017 Caio Lima. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
description: Mapped arguments property descriptor change with non-configurable property
info: >
Mapping keep working when property is set to non-configurable and its
value is changed using [[DefineOwnProperty]].
flags: [noStrict]
esid: sec-arguments-exotic-objects-defineownproperty-p-desc
includes: [propertyHelper.js]
---*/
function setArgumentValueWithDefineOwnProperty(a) {
Object.defineProperty(arguments, "0", {configurable: false});
Object.defineProperty(arguments, "0", {value: 2});
let propertyDescriptor = Object.getOwnPropertyDescriptor(arguments, "0");
assert.sameValue(propertyDescriptor.value, 2);
assert.sameValue(a, 2);
verifyEnumerable(arguments, "0");
verifyWritable(arguments, "0");
verifyNotConfigurable(arguments, "0");
}
setArgumentValueWithDefineOwnProperty(1);
reportCompare(0, 0);

Просмотреть файл

@ -0,0 +1,27 @@
// Copyright (C) 2017 Caio Lima. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
description: Property descriptor of mapped arguments object with non-configurable property
info: >
Mapping keep working when property is set to non-configurable, and its
descriptor needs to change properly.
flags: [noStrict]
esid: sec-arguments-exotic-objects-defineownproperty-p-desc
includes: [propertyHelper.js]
---*/
function argumentsAndSetMutableBinding(a) {
Object.defineProperty(arguments, "0", {configurable: false});
a = 2;
let propertyDescriptor = Object.getOwnPropertyDescriptor(arguments, "0");
assert.sameValue(propertyDescriptor.value, 2);
verifyEnumerable(arguments, "0");
verifyWritable(arguments, "0");
verifyNotConfigurable(arguments, "0");
}
argumentsAndSetMutableBinding(1);
reportCompare(0, 0);

Просмотреть файл

@ -0,0 +1,29 @@
// Copyright (C) 2017 Caio Lima. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
description: Mapped arguments property descriptor change with non-configurable, non-enumerable and non-writable property
info: >
Mapping stop working when property is set to non-writable. The
descriptor's enumerable property is the one set before the mapping removal.
flags: [noStrict]
esid: sec-arguments-exotic-objects-defineownproperty-p-desc
includes: [propertyHelper.js]
---*/
function fn(a) {
Object.defineProperty(arguments, "0", {configurable: false, enumerable: false, writable: false});
// Postcondition: Arguments mapping is removed.
a = 2;
let propertyDescriptor = Object.getOwnPropertyDescriptor(arguments, "0");
assert.sameValue(propertyDescriptor.value, 1);
verifyNotEnumerable(arguments, "0");
verifyNotWritable(arguments, "0");
verifyNotConfigurable(arguments, "0");
}
fn(1);
reportCompare(0, 0);

Просмотреть файл

@ -0,0 +1,38 @@
// Copyright (C) 2017 Caio Lima. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
description: Mapped arguments property descriptor change to non-configurable, non-enumerable and non-writable
info: >
Change the descriptor using [[DefineOwnProperty]] to {configurable: false, enumerable: false},
set arguments[0] = 2 and then change property descriptor to {writable: false}.
The descriptor's enumerable property is the one set before the mapping removal.
flags: [noStrict]
esid: sec-arguments-exotic-objects-defineownproperty-p-desc
includes: [propertyHelper.js]
---*/
function fn(a) {
Object.defineProperty(arguments, "0", {configurable: false, enumerable: false});
arguments[0] = 2;
Object.defineProperty(arguments, "0", {writable: false});
let propertyDescriptor = Object.getOwnPropertyDescriptor(arguments, "0");
assert.sameValue(propertyDescriptor.value, 2);
assert.sameValue(a, 2);
verifyNotEnumerable(arguments, "0");
verifyNotWritable(arguments, "0");
verifyNotConfigurable(arguments, "0");
// Postcondition: Arguments mapping is removed.
a = 3;
propertyDescriptor = Object.getOwnPropertyDescriptor(arguments, "0");
assert.sameValue(propertyDescriptor.value, 2);
verifyNotEnumerable(arguments, "0");
verifyNotWritable(arguments, "0");
verifyNotConfigurable(arguments, "0");
}
fn(1);
reportCompare(0, 0);

Просмотреть файл

@ -0,0 +1,38 @@
// Copyright (C) 2017 Caio Lima. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
description: Mapped arguments property descriptor change to non-configurable, non-enumerable and non-writable
info: >
Change the descriptor using [[DefineOwnProperty]] to
{configurable: false, enumerable: false}, set a = 2 and then
change property descriptor to {writable: false}. The descriptor's enumerable
property need to be the one set before the mapping removal.
flags: [noStrict]
esid: sec-arguments-exotic-objects-defineownproperty-p-desc
includes: [propertyHelper.js]
---*/
function fn(a) {
Object.defineProperty(arguments, "0", {configurable: false, enumerable: false});
a = 2;
Object.defineProperty(arguments, "0", {writable: false});
let propertyDescriptor = Object.getOwnPropertyDescriptor(arguments, "0");
assert.sameValue(propertyDescriptor.value, 2);
verifyNotEnumerable(arguments, "0");
verifyNotWritable(arguments, "0");
verifyNotConfigurable(arguments, "0");
// Postcondition: Arguments mapping is removed.
a = 3;
propertyDescriptor = Object.getOwnPropertyDescriptor(arguments, "0");
assert.sameValue(propertyDescriptor.value, 2);
verifyNotEnumerable(arguments, "0");
verifyNotWritable(arguments, "0");
verifyNotConfigurable(arguments, "0");
}
fn(1);
reportCompare(0, 0);

Просмотреть файл

@ -0,0 +1,30 @@
// Copyright (C) 2017 Caio Lima. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
description: Mapped arguments property descriptor change with non-configurable and non-writable property
info: >
Mapping stop working when property is set to non-writable. The
descriptor's value need to be the one set before the property be configured as
writable: false.
flags: [noStrict]
esid: sec-arguments-exotic-objects-defineownproperty-p-desc
includes: [propertyHelper.js]
---*/
function fn(a) {
Object.defineProperty(arguments, "0", {configurable: false, writable: false});
// Postcondition: Arguments mapping is removed.
a = 2;
let propertyDescriptor = Object.getOwnPropertyDescriptor(arguments, "0");
assert.sameValue(propertyDescriptor.value, 1);
verifyEnumerable(arguments, "0");
verifyNotWritable(arguments, "0");
verifyNotConfigurable(arguments, "0");
}
fn(1);
reportCompare(0, 0);

Просмотреть файл

@ -0,0 +1,36 @@
// Copyright (C) 2017 Caio Lima. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
description: Mapped arguments property descriptor change with non-configurable and non-writable property
info: >
Mapping stop working when property is set to non-writable. Change the
descriptor with two [[DefineOwnProperty]] calls. The descriptor's value need to be
the one set before the property be configured as writable: false.
flags: [noStrict]
esid: sec-arguments-exotic-objects-defineownproperty-p-desc
includes: [propertyHelper.js]
---*/
function fn(a) {
Object.defineProperty(arguments, "0", {configurable: false});
Object.defineProperty(arguments, "0", {writable: false});
let propertyDescriptor = Object.getOwnPropertyDescriptor(arguments, "0");
assert.sameValue(propertyDescriptor.value, 1);
verifyEnumerable(arguments, "0");
verifyNotWritable(arguments, "0");
verifyNotConfigurable(arguments, "0");
// Postcondition: Arguments mapping is removed.
a = 2;
propertyDescriptor = Object.getOwnPropertyDescriptor(arguments, "0");
assert.sameValue(propertyDescriptor.value, 1);
verifyEnumerable(arguments, "0");
verifyNotWritable(arguments, "0");
verifyNotConfigurable(arguments, "0");
}
fn(1);
reportCompare(0, 0);

Просмотреть файл

@ -0,0 +1,39 @@
// Copyright (C) 2017 Caio Lima. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
description: Mapped arguments property descriptor change to non-configurable and non-writable
info: >
Mapping just stop working when property is set to non-writable. Change the
descriptor using [[DefineOwnProperty]] to {configurable: false}, set arguments[0] = 2
and then change property descriptor to {writable: false}.
The descriptor's value need to be the one set before the property be
configured as {writable: false}.
flags: [noStrict]
esid: sec-arguments-exotic-objects-defineownproperty-p-desc
includes: [propertyHelper.js]
---*/
function fn(a) {
Object.defineProperty(arguments, "0", {configurable: false});
arguments[0] = 2;
Object.defineProperty(arguments, "0", {writable: false});
let propertyDescriptor = Object.getOwnPropertyDescriptor(arguments, "0");
assert.sameValue(propertyDescriptor.value, 2);
assert.sameValue(a, 2)
verifyEnumerable(arguments, "0");
verifyNotWritable(arguments, "0");
verifyNotConfigurable(arguments, "0");
// Postcondition: Arguments mapping is removed.
a = 3;
propertyDescriptor = Object.getOwnPropertyDescriptor(arguments, "0");
assert.sameValue(propertyDescriptor.value, 2);
verifyEnumerable(arguments, "0");
verifyNotWritable(arguments, "0");
verifyNotConfigurable(arguments, "0");
}
fn(1);
reportCompare(0, 0);

Просмотреть файл

@ -0,0 +1,38 @@
// Copyright (C) 2017 Caio Lima. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
description: Mapped arguments property descriptor change to non-configurable and non-writable
info: >
Mapping just stop working when property is set to non-writable. Change the
descriptor using [[DefineOwnProperty]] to {configurable: false}, set a = 2 and then
change property descriptor to {writable: false}. The descriptor's value is
the one set before the property be configured as {writable: false}.
flags: [noStrict]
esid: sec-arguments-exotic-objects-defineownproperty-p-desc
includes: [propertyHelper.js]
---*/
function fn(a) {
Object.defineProperty(arguments, "0", {configurable: false});
a = 2;
Object.defineProperty(arguments, "0", {writable: false});
let propertyDescriptor = Object.getOwnPropertyDescriptor(arguments, "0");
assert.sameValue(propertyDescriptor.value, 2);
verifyEnumerable(arguments, "0");
verifyNotWritable(arguments, "0");
verifyNotConfigurable(arguments, "0");
// Postcondition: Arguments mapping is removed.
a = 3;
propertyDescriptor = Object.getOwnPropertyDescriptor(arguments, "0");
assert.sameValue(propertyDescriptor.value, 2);
verifyEnumerable(arguments, "0");
verifyNotWritable(arguments, "0");
verifyNotConfigurable(arguments, "0");
}
fn(1);
reportCompare(0, 0);

Просмотреть файл

@ -0,0 +1,38 @@
// Copyright (C) 2017 Caio Lima. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
description: Mapped arguments property descriptor change to non-writable and non-configurable
info: >
Mapping stop working when property is set to non-writable. Here we change the
descriptor using [[DefineOwnProperty]] to {writable: false} and then
change property descriptor to {configurable: false} in sequence.
The property descriptor need to be the one set before the property be
configured as {writable: false}.
flags: [noStrict]
esid: sec-arguments-exotic-objects-defineownproperty-p-desc
includes: [propertyHelper.js]
---*/
function fn(a) {
Object.defineProperty(arguments, "0", {writable: false});
Object.defineProperty(arguments, "0", {configurable: false});
let propertyDescriptor = Object.getOwnPropertyDescriptor(arguments, "0");
assert.sameValue(propertyDescriptor.value, 1);
verifyEnumerable(arguments, "0");
verifyNotWritable(arguments, "0");
verifyNotConfigurable(arguments, "0");
// Postcondition: Arguments mapping is removed. Descriptors need to be the same
// as above.
a = 2;
propertyDescriptor = Object.getOwnPropertyDescriptor(arguments, "0");
assert.sameValue(propertyDescriptor.value, 1);
verifyEnumerable(arguments, "0");
verifyNotWritable(arguments, "0");
verifyNotConfigurable(arguments, "0");
}
fn(1);
reportCompare(0, 0);

Просмотреть файл

@ -0,0 +1,39 @@
// Copyright (C) 2017 Caio Lima. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
description: Mapped arguments property descriptor change to non-writable and non-configurable
info: >
Mapping stop working when property is set to non-writable. Change the
descriptor using [[DefineOwnProperty]] to {writable: false}, set argument[0] = 2 and then
change property descriptor to {configurable: false}.
The descriptor's value is the one set before the property be
configured as {writable: false} because mapping was removed.
flags: [noStrict]
esid: sec-arguments-exotic-objects-defineownproperty-p-desc
includes: [propertyHelper.js]
---*/
function fn(a) {
Object.defineProperty(arguments, "0", {writable: false});
arguments[0] = 2;
Object.defineProperty(arguments, "0", {configurable: false});
let propertyDescriptor = Object.getOwnPropertyDescriptor(arguments, "0");
assert.sameValue(propertyDescriptor.value, 1);
assert.sameValue(a, 1);
verifyEnumerable(arguments, "0");
verifyNotWritable(arguments, "0");
verifyNotConfigurable(arguments, "0");
// Postcondition: Arguments mapping is removed.
a = 3;
propertyDescriptor = Object.getOwnPropertyDescriptor(arguments, "0");
assert.sameValue(propertyDescriptor.value, 1);
verifyEnumerable(arguments, "0");
verifyNotWritable(arguments, "0");
verifyNotConfigurable(arguments, "0");
}
fn(1);
reportCompare(0, 0);

Просмотреть файл

@ -0,0 +1,30 @@
// Copyright (C) 2017 Caio Lima. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
description: Mapped arguments property descriptor change to non-writable and non-configurable
info: >
Mapping just stop working when property is set to non-writable. Change the
descriptor using [[DefineOwnProperty]] to {writable: false}, set a = 2 and then
change property descriptor to {configurable: false}.
The descriptor's value is the one set before the property be
configured as {writable: false} because mapping was removed.
flags: [noStrict]
esid: sec-arguments-exotic-objects-defineownproperty-p-desc
includes: [propertyHelper.js]
---*/
function fn(a) {
Object.defineProperty(arguments, "0", {writable: false});
a = 2;
Object.defineProperty(arguments, "0", {configurable: false});
let propertyDescriptor = Object.getOwnPropertyDescriptor(arguments, "0");
assert.sameValue(propertyDescriptor.value, 1);
verifyEnumerable(arguments, "0");
verifyNotWritable(arguments, "0");
verifyNotConfigurable(arguments, "0");
}
fn(1);
reportCompare(0, 0);

Просмотреть файл

@ -0,0 +1,37 @@
// Copyright (C) 2017 Caio Lima. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
description: Mapped arguments property descriptor change to non-writable and non-configurable
info: >
Change the descriptor using [[DefineOwnProperty]] to
{writable: false, enumerable: false} and then
change property descriptor to {configurable: false}.
The descriptor's enumerable property continue with its configured value
even if mapping stops.
flags: [noStrict]
esid: sec-arguments-exotic-objects-defineownproperty-p-desc
includes: [propertyHelper.js]
---*/
function fn(a) {
Object.defineProperty(arguments, "0", {writable: false, enumerable: false});
Object.defineProperty(arguments, "0", {configurable: false});
let propertyDescriptor = Object.getOwnPropertyDescriptor(arguments, "0");
assert.sameValue(propertyDescriptor.value, 1);
verifyNotEnumerable(arguments, "0");
verifyNotWritable(arguments, "0");
verifyNotConfigurable(arguments, "0");
// Postcondition: Arguments mapping is removed.
a = 2;
propertyDescriptor = Object.getOwnPropertyDescriptor(arguments, "0");
assert.sameValue(propertyDescriptor.value, 1);
verifyNotEnumerable(arguments, "0");
verifyNotWritable(arguments, "0");
verifyNotConfigurable(arguments, "0");
}
fn(1);
reportCompare(0, 0);

Просмотреть файл

@ -0,0 +1,36 @@
// Copyright (C) 2017 Caio Lima. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
description: Mapped arguments property descriptor change to non-writable, non-enumerable and non-configurable
info: >
Change the descriptor using [[DefineOwnProperty]] to {writable: false, enumerable: false},
set argument[0] = 2 and then change property descriptor to {configurable: false}.
The descriptor's enumerable property continues with its configured value.
flags: [noStrict]
esid: sec-arguments-exotic-objects-defineownproperty-p-desc
includes: [propertyHelper.js]
---*/
function fn(a) {
Object.defineProperty(arguments, "0", {writable: false, enumerable: false});
arguments[0] = 2;
Object.defineProperty(arguments, "0", {configurable: false});
let propertyDescriptor = Object.getOwnPropertyDescriptor(arguments, "0");
assert.sameValue(propertyDescriptor.value, 1);
verifyNotEnumerable(arguments, "0");
verifyNotWritable(arguments, "0");
verifyNotConfigurable(arguments, "0");
// Postcondition: Arguments mapping is removed.
a = 3;
propertyDescriptor = Object.getOwnPropertyDescriptor(arguments, "0");
assert.sameValue(propertyDescriptor.value, 1);
verifyNotEnumerable(arguments, "0");
verifyNotWritable(arguments, "0");
verifyNotConfigurable(arguments, "0");
}
fn(1);
reportCompare(0, 0);

Просмотреть файл

@ -0,0 +1,29 @@
// Copyright (C) 2017 Caio Lima. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
description: Mapped arguments property descriptor change to non-writable, non-enumerable and non-configurable
info: >
Change the descriptor using [[DefineOwnProperty]] to
{writable: false, enumerable: false}, change argument[0]
value to 2 using [[DefineOwnProperty]] and then
change property descriptor to {configurable: false}.
The descriptor's enumerable property continues with its configured value.
flags: [noStrict]
esid: sec-arguments-exotic-objects-defineownproperty-p-desc
includes: [propertyHelper.js]
---*/
function fn(a) {
Object.defineProperty(arguments, "0", {writable: false, enumerable: false, value: 2, configurable: false});
let propertyDescriptor = Object.getOwnPropertyDescriptor(arguments, "0");
assert.sameValue(propertyDescriptor.value, 2);
assert.sameValue(arguments[0], 2);
verifyNotEnumerable(arguments, "0");
verifyNotWritable(arguments, "0");
verifyNotConfigurable(arguments, "0");
}
fn(1);
reportCompare(0, 0);

Просмотреть файл

@ -0,0 +1,37 @@
// Copyright (C) 2017 Caio Lima. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
description: Mapped arguments property descriptor change to non-writable, non-enumerable and non-configurable
info: >
Change the descriptor using [[DefineOwnProperty]] to
{writable: false, enumerable: false}, set a = 2 and then
change property descriptor to {configurable: false}.
The descriptor's enumerable property continue with its configured value.
flags: [noStrict]
esid: sec-arguments-exotic-objects-defineownproperty-p-desc
includes: [propertyHelper.js]
---*/
function fn(a) {
Object.defineProperty(arguments, "0", {writable: false, enumerable: false});
a = 2;
Object.defineProperty(arguments, "0", {configurable: false});
let propertyDescriptor = Object.getOwnPropertyDescriptor(arguments, "0");
assert.sameValue(propertyDescriptor.value, 1);
verifyNotEnumerable(arguments, "0");
verifyNotWritable(arguments, "0");
verifyNotConfigurable(arguments, "0");
// Postcondition: Arguments mapping is removed.
a = 3;
propertyDescriptor = Object.getOwnPropertyDescriptor(arguments, "0");
assert.sameValue(propertyDescriptor.value, 1);
verifyNotEnumerable(arguments, "0");
verifyNotWritable(arguments, "0");
verifyNotConfigurable(arguments, "0");
}
fn(1);
reportCompare(0, 0);

Просмотреть файл

Просмотреть файл

@ -0,0 +1,15 @@
// 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: pending
description: >
It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and
IsSimpleParameterList of UniqueFormalParameters is false.
negative:
phase: early
type: SyntaxError
---*/
(async function*(x = 1) {"use strict"});

Просмотреть файл

@ -0,0 +1,16 @@
'use strict';
// 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: pending
description: >
It is a SyntaxError if FormalParameters contains arguments in strict mode.
negative:
phase: early
type: SyntaxError
flags: [onlyStrict]
---*/
(async function*(arguments) { });

Просмотреть файл

@ -0,0 +1,14 @@
// 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: 12.1.1
description: >
`await` is not a valid BindingIdentifier for AsyncGeneratorExpressions.
negative:
phase: early
type: SyntaxError
---*/
(async function* await() { });

Просмотреть файл

@ -0,0 +1,17 @@
'use strict';
// 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: pending
description: >
If the source code matching this production is strict code, it is a
Syntax Error if BindingIdentifier is the IdentifierName arguments.
negative:
phase: early
type: SyntaxError
flags: [onlyStrict]
---*/
(async function* arguments() { });

Просмотреть файл

@ -0,0 +1,17 @@
'use strict';
// 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: pending
description: >
If the source code matching this production is strict code, it is a
Syntax Error if BindingIdentifier is the IdentifierName eval.
negative:
phase: early
type: SyntaxError
flags: [onlyStrict]
---*/
(async function* eval() { });

Просмотреть файл

@ -0,0 +1,14 @@
// 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: pending
description: >
It is a syntax error if AsyncGeneratorBody contains SuperCall is true.
negative:
phase: early
type: SyntaxError
---*/
(async function*() { super(); });

Просмотреть файл

@ -0,0 +1,14 @@
// 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: pending
description: >
It is a syntax error if AsyncGeneratorBody contains SuperProperty is true.
negative:
phase: early
type: SyntaxError
---*/
(async function*() { super.prop; });

Просмотреть файл

@ -0,0 +1,16 @@
'use strict';
// 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: pending
description: >
It is a SyntaxError if FormalParameters contains eval in strict mode.
negative:
phase: early
type: SyntaxError
flags: [onlyStrict]
---*/
(async function*(eval) { });

Просмотреть файл

@ -0,0 +1,15 @@
// 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: pending
description: >
It is a SyntaxError if BoundNames of FormalParameters also occurs in the
LexicallyDeclaredNames of AsyncFunctionBody
negative:
phase: early
type: SyntaxError
---*/
(async function*(a) { const a = 0; });

Просмотреть файл

@ -0,0 +1,15 @@
// 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: pending
description: >
It is a SyntaxError if BoundNames of FormalParameters also occurs in the
LexicallyDeclaredNames of AsyncFunctionBody
negative:
phase: early
type: SyntaxError
---*/
(async function*(a) { let a; });

Просмотреть файл

@ -0,0 +1,14 @@
// 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: pending
description: >
It is a Syntax Error if FormalParameters Contains AwaitExpression is true.
negative:
phase: early
type: SyntaxError
---*/
(async function*(x = await 1) { });

Просмотреть файл

@ -0,0 +1,15 @@
// 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: 12.1
description: >
`await` is a reserved keyword within async generator function bodies and may
not be used as the binding identifier of a parameter.
negative:
phase: early
type: SyntaxError
---*/
(async function*(await) { });

Просмотреть файл

@ -0,0 +1,14 @@
// 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: pending
description: >
It is a syntax error if FormalParameters contains SuperCall is true.
negative:
phase: early
type: SyntaxError
---*/
(async function*(a = super()) { });

Просмотреть файл

@ -0,0 +1,14 @@
// 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: pending
description: >
It is a syntax error if FormalParameters contains SuperProperty is true.
negative:
phase: early
type: SyntaxError
---*/
(async function*(a = super.prop) { });

Просмотреть файл

@ -0,0 +1,14 @@
// 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: pending
description: >
It is a Syntax Error if FormalParameters Contains YieldExpression is true.
negative:
phase: early
type: SyntaxError
---*/
(async function*(x = yield) { });

Просмотреть файл

@ -0,0 +1,15 @@
// 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: 12.1
description: >
`await` is a reserved keyword within async generator function bodies and may
not be used as the binding identifier of a parameter.
negative:
phase: early
type: SyntaxError
---*/
(async function*(yield) { });

Просмотреть файл

@ -0,0 +1,17 @@
// 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: 12.1.1
description: >
`await` is a reserved keyword within async generator function bodies and may
not be used as a label.
negative:
phase: early
type: SyntaxError
---*/
(async function*() {
await: 1;
});

Просмотреть файл

@ -0,0 +1,17 @@
// 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: 12.1.1
description: >
`yield` is a reserved keyword within async generator function bodies and may
not be used as a label.
negative:
phase: early
type: SyntaxError
---*/
(async function*() {
yield: 1;
});

Просмотреть файл

@ -0,0 +1,14 @@
// 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: pending
description: >
Async generator function expressions are not a simple assignment target.
negative:
phase: early
type: ReferenceError
---*/
(async function*() { } = 1);

Просмотреть файл

@ -0,0 +1,14 @@
// 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: 12.1.1
description: >
`yield` is not a valid BindingIdentifier for AsyncGeneratorExpressions.
negative:
phase: early
type: SyntaxError
---*/
(async function* yield() { });

Просмотреть файл

@ -0,0 +1,17 @@
// 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: >
A newline may not precede the `*` token in a `yield` expression.
negative:
phase: early
type: SyntaxError
---*/
(async function*() {
yield
* 1;
});

Просмотреть файл

@ -0,0 +1,24 @@
// 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: >
AwaitExpressions are valid operands to yield expressions.
flags: [async]
---*/
var iter = (async function*() {
yield await "a";
})();
iter.next().then(function(result) {
assert.sameValue(result.value, "a", 'First result `value`');
assert.sameValue(result.done, false, 'First result `done` flag');
}).then(undefined, $DONE);
iter.next().then(function(result) {
assert.sameValue(result.value, undefined, 'Second result `value`');
assert.sameValue(result.done, true, 'Second result `done` flag');
}).then($DONE, $DONE);

Просмотреть файл

@ -0,0 +1,26 @@
// 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: >
AwaitExpressions are valid operands to yield expressions.
flags: [async]
---*/
var iter = (async function*() {
yield await new Promise(function(resolve) {
resolve("a");
});
})();
iter.next().then(function(result) {
assert.sameValue(result.value, "a", 'First result `value`');
assert.sameValue(result.done, false, 'First result `done` flag');
}).then(undefined, $DONE);
iter.next().then(function(result) {
assert.sameValue(result.value, undefined, 'Second result `value`');
assert.sameValue(result.done, true, 'Second result `done` flag');
}).then($DONE, $DONE);

Просмотреть файл

@ -0,0 +1,30 @@
// 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: >
AwaitExpressions are valid operands to yield expressions.
flags: [async]
---*/
var thenable = {
then: function(resolve, reject) {
resolve("a");
}
};
var iter = (async function*() {
yield await thenable;
})();
iter.next().then(function(result) {
assert.sameValue(result.value, "a", 'First result `value`');
assert.sameValue(result.done, false, 'First result `done` flag');
}).then(undefined, $DONE);
iter.next().then(function(result) {
assert.sameValue(result.value, undefined, 'Second result `value`');
assert.sameValue(result.done, true, 'Second result `done` flag');
}).then($DONE, $DONE);

Просмотреть файл

@ -0,0 +1,31 @@
// 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` expressions may be used as the right-hand-side of other `yield`
expressions.
flags: [async]
---*/
var g = async function*() {
yield yield 1;
};
var iter = g();
iter.next().then(function(result) {
assert.sameValue(result.value, 1, 'First result `value`');
assert.sameValue(result.done, false, 'First result `done` flag');
}).then(undefined, $DONE);
iter.next().then(function(result) {
assert.sameValue(result.value, undefined, 'Second result `value`');
assert.sameValue(result.done, false, 'Second result `done` flag');
}).then(undefined, $DONE);
iter.next().then(function(result) {
assert.sameValue(result.value, undefined, 'Third result `value`');
assert.sameValue(result.done, true, 'Thid result `done` flag');
}).then($DONE, $DONE);

Просмотреть файл

@ -0,0 +1,41 @@
// 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(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(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);

Просмотреть файл

@ -0,0 +1,26 @@
// 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: >
Newlines terminate `yield` expressions.
flags: [async]
---*/
var g = async function*() {
yield
1;
};
var iter = g();
iter.next().then(function(result) {
assert.sameValue(result.value, undefined, 'First result `value`');
assert.sameValue(result.done, false, 'First result `done` flag');
}).then(undefined, $DONE);
iter.next().then(function(result) {
assert.sameValue(result.value, undefined, 'Second result `value`');
assert.sameValue(result.done, true, 'Second result `done` flag');
}).then($DONE, $DONE);

Просмотреть файл

@ -0,0 +1,20 @@
// 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: >
The right-hand side of a `yield *` expression may appear on a new line.
flags: [async]
---*/
var g = async function*() {};
(async function*() {
yield*
g();
})().next().then(function(result) {
assert.sameValue(result.value, undefined);
assert.sameValue(result.done, true);
}).then($DONE, $DONE);

Просмотреть файл

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше