Bug 1434953 - Part 1: Update test262 - Feb 02 2018 edition. rs=sfink

--HG--
extra : rebase_source : f92bad42fb9dc3b7eca98f0b6859b1328ff9a924
This commit is contained in:
André Bargull 2018-02-02 06:01:29 -08:00
parent a24f067417
commit f107c47d2a
236 changed files with 5483 additions and 757 deletions

View File

@ -1,5 +1,5 @@
commit 73120a5492ce274d551d2a215e65ba30085be7ef commit 82c6148980332febe92a544a1fb653718e9fdb57
Author: Rick Waldron <waldron.rick@gmail.com> Author: André Bargull <andre.bargull@gmail.com>
Date: Wed Jan 10 17:33:03 2018 -0500 Date: Thu Feb 1 11:04:51 2018 -0800
Fix: various lint fixes Add missing closing parenthesis and remove invalid async flag (#1402)

View File

@ -0,0 +1,33 @@
// Copyright (C) 2017 Valerie Young. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-string.prototype.trimLeft
description: >
String.prototype.trimLeft.length is 0.
info: >
String.prototype.trimLeft ( )
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]
features: [string-trimming]
---*/
verifyProperty(String.prototype.trimLeft, "length", {
value: 0,
enumerable: false,
writable: false,
configurable: true,
});
reportCompare(0, 0);

View File

@ -0,0 +1,24 @@
// Copyright (C) 2017 Valerie Young. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-string.prototype.trimLeft
description: >
String.prototype.trimLeft.name is "trimStart".
info: >
String.prototype.trimLeft ( )
The function object that is the initial value of String.prototype.trimLeft is the same function object that is the initial value of String.prototype.trimStart.
includes: [propertyHelper.js]
features: [string-trimming,String.prototype.trimStart]
---*/
verifyProperty(String.prototype.trimLeft, "name", {
value: "trimStart",
enumerable: false,
writable: false,
configurable: true,
});
reportCompare(0, 0);

View File

@ -0,0 +1,24 @@
// Copyright (C) 2017 The Valerie Young. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-string.prototype.trimLeft
description: >
"trimLeft" property of String.prototype
info: >
17 ECMAScript Standard Built-in Objects:
Every other data property described in clauses 18 through 26 and in Annex B.2
has the attributes { [[Writable]]: true, [[Enumerable]]: false,
[[Configurable]]: true } unless otherwise specified.
includes: [propertyHelper.js]
features: [string-trimming]
---*/
verifyProperty(String.prototype, "trimLeft", {
enumerable: false,
writable: true,
configurable: true,
});
reportCompare(0, 0);

View File

@ -0,0 +1,19 @@
// Copyright (C) 2017 Valerie Young. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-string.prototype.trimLeft
description: >
String.prototype.trimLeft is a reference to String.prototype.trimStart.
info: >
String.prototype.trimLeft ( )
The function object that is the initial value of String.prototype.trimLeft
is the same function object that is the initial value of
String.prototype.trimStart.
features: [string-trimming]
---*/
assert.sameValue(String.prototype.trimLeft, String.prototype.trimStart);
reportCompare(0, 0);

View File

@ -0,0 +1,33 @@
// Copyright (C) 2017 Valerie Young. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-string.prototype.trimRight
description: >
String.prototype.trimRight.length is 0.
info: >
String.prototype.trimRight ( )
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]
features: [string-trimming]
---*/
verifyProperty(String.prototype.trimRight, "length", {
value: 0,
enumerable: false,
writable: false,
configurable: true,
});
reportCompare(0, 0);

View File

@ -0,0 +1,23 @@
// Copyright (C) 2017 Valerie Young. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-string.prototype.trimRight
description: >
String.prototype.trimRight.name is "trimEnd".
info: >
String.prototype.trimRight ( )#
The function object that is the initial value of String.prototype.trimRight is the same function object that is the initial value of String.prototype.trimEnd.
includes: [propertyHelper.js]
features: [string-trimming,String.prototype.trimEnd]
---*/
verifyProperty(String.prototype.trimRight, "name", {
value: "trimEnd",
enumerable: false,
writable: false,
configurable: true,
});
reportCompare(0, 0);

View File

@ -0,0 +1,24 @@
// Copyright (C) 2017 The Valerie Young. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-string.prototype.trimRight
description: >
"trimRight" property of String.prototype
info: >
17 ECMAScript Standard Built-in Objects:
Every other data property described in clauses 18 through 26 and in Annex B.2
has the attributes { [[Writable]]: true, [[Enumerable]]: false,
[[Configurable]]: true } unless otherwise specified.
includes: [propertyHelper.js]
features: [string-trimming]
---*/
verifyProperty(String.prototype, "trimRight", {
enumerable: false,
writable: true,
configurable: true,
});
reportCompare(0, 0);

View File

@ -0,0 +1,19 @@
// Copyright (C) 2017 Valerie Young. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-string.prototype.trimRight
description: >
String.prototype.trimRight is a reference to String.prototype.trimEnd.
info: >
String.prototype.trimRight ( )
The function object that is the initial value of String.prototype.trimRight
is the same function object that is the initial value of
String.prototype.trimEnd.
features: [string-trimming]
---*/
assert.sameValue(String.prototype.trimRight, String.prototype.trimEnd);
reportCompare(0, 0);

View File

@ -3,7 +3,6 @@
// This code is governed by the BSD license found in the LICENSE file. // This code is governed by the BSD license found in the LICENSE file.
/*--- /*---
esid: sec-html-like-comments esid: sec-html-like-comments
esid: sec-html-like-comments
description: Optional HTMLCloseComment following MultiLineComment description: Optional HTMLCloseComment following MultiLineComment
info: | info: |
Comment :: Comment ::

View File

@ -3,7 +3,6 @@
// This code is governed by the BSD license found in the LICENSE file. // This code is governed by the BSD license found in the LICENSE file.
/*--- /*---
esid: sec-html-like-comments esid: sec-html-like-comments
esid: sec-html-like-comments
description: > description: >
A SingleLineHTMLCloseComment is considered to be a LineTerminator for A SingleLineHTMLCloseComment is considered to be a LineTerminator for
purposes of parsing by the syntactic grammar. purposes of parsing by the syntactic grammar.

View File

@ -3,7 +3,6 @@
// This code is governed by the BSD license found in the LICENSE file. // This code is governed by the BSD license found in the LICENSE file.
/*--- /*---
esid: sec-html-like-comments esid: sec-html-like-comments
esid: sec-html-like-comments
description: SingleLineHTMLCloseComment description: SingleLineHTMLCloseComment
info: | info: |
Comment :: Comment ::

View File

@ -3,7 +3,6 @@
// This code is governed by the BSD license found in the LICENSE file. // This code is governed by the BSD license found in the LICENSE file.
/*--- /*---
esid: sec-html-like-comments esid: sec-html-like-comments
esid: sec-html-like-comments
description: SingleLineHTMLOpenComment description: SingleLineHTMLOpenComment
info: | info: |
Comment :: Comment ::

View File

@ -15,7 +15,6 @@ info: |
a. Let hasNameProperty be HasOwnProperty(propValue, "name"). a. Let hasNameProperty be HasOwnProperty(propValue, "name").
b. ReturnIfAbrupt(hasNameProperty). b. ReturnIfAbrupt(hasNameProperty).
c. If hasNameProperty is false, perform SetFunctionName(propValue, propKey). c. If hasNameProperty is false, perform SetFunctionName(propValue, propKey).
includes: [propertyHelper.js]
---*/ ---*/
var o; var o;

View File

@ -2,7 +2,6 @@
// This code is governed by the BSD license found in the LICENSE file. // This code is governed by the BSD license found in the LICENSE file.
/*--- /*---
esid: sec-additional-syntax-numeric-literals esid: sec-additional-syntax-numeric-literals
esid: sec-additional-syntax-numeric-literals
description: Mathematical value for LegacyOctalIntegerLiteral description: Mathematical value for LegacyOctalIntegerLiteral
info: | info: |
NumericLiteral :: NumericLiteral ::

View File

@ -2,7 +2,6 @@
// This code is governed by the BSD license found in the LICENSE file. // This code is governed by the BSD license found in the LICENSE file.
/*--- /*---
esid: sec-additional-syntax-numeric-literals esid: sec-additional-syntax-numeric-literals
esid: sec-additional-syntax-numeric-literals
description: Mathematical value for NonOctalDecimalIntegerLiteral description: Mathematical value for NonOctalDecimalIntegerLiteral
info: | info: |
DecimalIntegerLiteral :: DecimalIntegerLiteral ::

View File

@ -12,8 +12,12 @@ assert.compareArray([1, 2].flatMap(function(e) {
return [e, e * 2]; return [e, e * 2];
}), [1, 2, 2, 4], 'array depth is 1'); }), [1, 2, 2, 4], 'array depth is 1');
assert.compareArray([1, 2, 3].flatMap(function(ele) { var result = [1, 2, 3].flatMap(function(ele) {
return [[ele * 2]]; return [[ele * 2]];
}), [[2], [4], [6]], 'array depth is more than 1'); });
assert.sameValue(result.length, 3, 'array depth is more than 1 - length');
assert.compareArray(result[0], [2], 'array depth is more than 1 - 1st element');
assert.compareArray(result[1], [4], 'array depth is more than 1 - 2nd element');
assert.compareArray(result[2], [6], 'array depth is more than 1 - 3rd element');
reportCompare(0, 0); reportCompare(0, 0);

View File

@ -9,7 +9,7 @@ info: |
ES6 section 17: Every other data property described in clauses 18 through 26 ES6 section 17: Every other data property described in clauses 18 through 26
and in Annex B.2 has the attributes { [[Writable]]: true, and in Annex B.2 has the attributes { [[Writable]]: true,
[[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified. [[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified.
includes: [propertyHelper.js, testTypedArray.js] includes: [propertyHelper.js]
---*/ ---*/
verifyNotEnumerable(ArrayBuffer, "isView"); verifyNotEnumerable(ArrayBuffer, "isView");

View File

@ -1,9 +1,11 @@
// |reftest| skip-if(!this.hasOwnProperty('SharedArrayBuffer')) -- SharedArrayBuffer is not enabled unconditionally
// Copyright (C) 2017 Mozilla Corporation. All rights reserved. // Copyright (C) 2017 Mozilla Corporation. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file. // This code is governed by the BSD license found in the LICENSE file.
/*--- /*---
esid: sec-get-arraybuffer.prototype.bytelength esid: sec-get-arraybuffer.prototype.bytelength
description: Throws a TypeError exception when `this` is a SharedArrayBuffer description: Throws a TypeError exception when `this` is a SharedArrayBuffer
features: [SharedArrayBuffer]
---*/ ---*/
var getter = Object.getOwnPropertyDescriptor( var getter = Object.getOwnPropertyDescriptor(

View File

@ -1,3 +1,4 @@
// |reftest| skip-if(!this.hasOwnProperty('SharedArrayBuffer')) -- SharedArrayBuffer is not enabled unconditionally
// Copyright (C) 2017 Mozilla Corporation. All rights reserved. // Copyright (C) 2017 Mozilla Corporation. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file. // This code is governed by the BSD license found in the LICENSE file.
@ -5,6 +6,7 @@
esid: sec-arraybuffer.prototype.slice esid: sec-arraybuffer.prototype.slice
description: > description: >
Throws a TypeError if `this` is a SharedArrayBuffer Throws a TypeError if `this` is a SharedArrayBuffer
features: [SharedArrayBuffer]
---*/ ---*/
assert.throws(TypeError, function() { assert.throws(TypeError, function() {

View File

@ -10,9 +10,14 @@ includes: [testAtomics.js, testTypedArray.js]
features: [SharedArrayBuffer, ArrayBuffer, DataView, Atomics, arrow-function, let, TypedArray, for-of] features: [SharedArrayBuffer, ArrayBuffer, DataView, Atomics, arrow-function, let, TypedArray, for-of]
---*/ ---*/
var sab = new SharedArrayBuffer(4); var sab = new SharedArrayBuffer(8);
var views = [Int8Array, Uint8Array, Int16Array, Uint16Array, Int32Array, Uint32Array]; var views = [Int8Array, Uint8Array, Int16Array, Uint16Array, Int32Array, Uint32Array];
if (typeof BigInt !== "undefined") {
views.push(BigInt64Array);
views.push(BigUint64Array);
}
testWithTypedArrayConstructors(function(View) { testWithTypedArrayConstructors(function(View) {
let view = new View(sab); let view = new View(sab);
testWithAtomicsOutOfBoundsIndices(function(IdxGen) { testWithAtomicsOutOfBoundsIndices(function(IdxGen) {

View File

@ -13,6 +13,11 @@ var ab = new ArrayBuffer(16);
var int_views = [Int8Array, Uint8Array, Int16Array, Uint16Array, Int32Array, Uint32Array]; var int_views = [Int8Array, Uint8Array, Int16Array, Uint16Array, Int32Array, Uint32Array];
if (typeof BigInt !== "undefined") {
int_views.push(BigInt64Array);
int_views.push(BigUint64Array);
}
testWithTypedArrayConstructors(function(View) { testWithTypedArrayConstructors(function(View) {
var view = new View(ab); var view = new View(ab);

View File

@ -10,9 +10,14 @@ includes: [testAtomics.js, testTypedArray.js]
features: [SharedArrayBuffer, ArrayBuffer, DataView, Atomics, arrow-function, let, TypedArray, for-of] features: [SharedArrayBuffer, ArrayBuffer, DataView, Atomics, arrow-function, let, TypedArray, for-of]
---*/ ---*/
var sab = new SharedArrayBuffer(4); var sab = new SharedArrayBuffer(8);
var views = [Int8Array, Uint8Array, Int16Array, Uint16Array, Int32Array, Uint32Array]; var views = [Int8Array, Uint8Array, Int16Array, Uint16Array, Int32Array, Uint32Array];
if (typeof BigInt !== "undefined") {
views.push(BigInt64Array);
views.push(BigUint64Array);
}
testWithTypedArrayConstructors(function(View) { testWithTypedArrayConstructors(function(View) {
let view = new View(sab); let view = new View(sab);
testWithAtomicsOutOfBoundsIndices(function(IdxGen) { testWithAtomicsOutOfBoundsIndices(function(IdxGen) {

View File

@ -13,6 +13,11 @@ var ab = new ArrayBuffer(16);
var int_views = [Int8Array, Uint8Array, Int16Array, Uint16Array, Int32Array, Uint32Array]; var int_views = [Int8Array, Uint8Array, Int16Array, Uint16Array, Int32Array, Uint32Array];
if (typeof BigInt !== "undefined") {
int_views.push(BigInt64Array);
int_views.push(BigUint64Array);
}
testWithTypedArrayConstructors(function(View) { testWithTypedArrayConstructors(function(View) {
var view = new View(ab); var view = new View(ab);

View File

@ -10,9 +10,14 @@ includes: [testAtomics.js, testTypedArray.js]
features: [SharedArrayBuffer, ArrayBuffer, DataView, Atomics, arrow-function, let, TypedArray, for-of] features: [SharedArrayBuffer, ArrayBuffer, DataView, Atomics, arrow-function, let, TypedArray, for-of]
---*/ ---*/
var sab = new SharedArrayBuffer(4); var sab = new SharedArrayBuffer(8);
var views = [Int8Array, Uint8Array, Int16Array, Uint16Array, Int32Array, Uint32Array]; var views = [Int8Array, Uint8Array, Int16Array, Uint16Array, Int32Array, Uint32Array];
if (typeof BigInt !== "undefined") {
views.push(BigInt64Array);
views.push(BigUint64Array);
}
testWithTypedArrayConstructors(function(View) { testWithTypedArrayConstructors(function(View) {
let view = new View(sab); let view = new View(sab);
testWithAtomicsOutOfBoundsIndices(function(IdxGen) { testWithAtomicsOutOfBoundsIndices(function(IdxGen) {

View File

@ -13,6 +13,11 @@ var ab = new ArrayBuffer(16);
var int_views = [Int8Array, Uint8Array, Int16Array, Uint16Array, Int32Array, Uint32Array]; var int_views = [Int8Array, Uint8Array, Int16Array, Uint16Array, Int32Array, Uint32Array];
if (typeof BigInt !== "undefined") {
int_views.push(BigInt64Array);
int_views.push(BigUint64Array);
}
testWithTypedArrayConstructors(function(View) { testWithTypedArrayConstructors(function(View) {
var view = new View(ab); var view = new View(ab);

View File

@ -10,9 +10,14 @@ includes: [testAtomics.js, testTypedArray.js]
features: [SharedArrayBuffer, ArrayBuffer, DataView, Atomics, arrow-function, let, TypedArray, for-of] features: [SharedArrayBuffer, ArrayBuffer, DataView, Atomics, arrow-function, let, TypedArray, for-of]
---*/ ---*/
var sab = new SharedArrayBuffer(4); var sab = new SharedArrayBuffer(8);
var views = [Int8Array, Uint8Array, Int16Array, Uint16Array, Int32Array, Uint32Array]; var views = [Int8Array, Uint8Array, Int16Array, Uint16Array, Int32Array, Uint32Array];
if (typeof BigInt !== "undefined") {
views.push(BigInt64Array);
views.push(BigUint64Array);
}
testWithTypedArrayConstructors(function(View) { testWithTypedArrayConstructors(function(View) {
let view = new View(sab); let view = new View(sab);
testWithAtomicsOutOfBoundsIndices(function(IdxGen) { testWithAtomicsOutOfBoundsIndices(function(IdxGen) {

View File

@ -13,6 +13,11 @@ var ab = new ArrayBuffer(16);
var int_views = [Int8Array, Uint8Array, Int16Array, Uint16Array, Int32Array, Uint32Array]; var int_views = [Int8Array, Uint8Array, Int16Array, Uint16Array, Int32Array, Uint32Array];
if (typeof BigInt !== "undefined") {
int_views.push(BigInt64Array);
int_views.push(BigUint64Array);
}
testWithTypedArrayConstructors(function(View) { testWithTypedArrayConstructors(function(View) {
var view = new View(ab); var view = new View(ab);

View File

@ -10,9 +10,14 @@ includes: [testAtomics.js, testTypedArray.js]
features: [SharedArrayBuffer, ArrayBuffer, DataView, Atomics, arrow-function, let, TypedArray, for-of] features: [SharedArrayBuffer, ArrayBuffer, DataView, Atomics, arrow-function, let, TypedArray, for-of]
---*/ ---*/
var sab = new SharedArrayBuffer(4); var sab = new SharedArrayBuffer(8);
var views = [Int8Array, Uint8Array, Int16Array, Uint16Array, Int32Array, Uint32Array]; var views = [Int8Array, Uint8Array, Int16Array, Uint16Array, Int32Array, Uint32Array];
if (typeof BigInt !== "undefined") {
views.push(BigInt64Array);
views.push(BigUint64Array);
}
testWithTypedArrayConstructors(function(View) { testWithTypedArrayConstructors(function(View) {
let view = new View(sab); let view = new View(sab);
testWithAtomicsOutOfBoundsIndices(function(IdxGen) { testWithAtomicsOutOfBoundsIndices(function(IdxGen) {

View File

@ -13,6 +13,11 @@ var ab = new ArrayBuffer(16);
var int_views = [Int8Array, Uint8Array, Int16Array, Uint16Array, Int32Array, Uint32Array]; var int_views = [Int8Array, Uint8Array, Int16Array, Uint16Array, Int32Array, Uint32Array];
if (typeof BigInt !== "undefined") {
int_views.push(BigInt64Array);
int_views.push(BigUint64Array);
}
testWithTypedArrayConstructors(function(View) { testWithTypedArrayConstructors(function(View) {
var view = new View(ab); var view = new View(ab);

View File

@ -10,9 +10,14 @@ includes: [testAtomics.js, testTypedArray.js]
features: [SharedArrayBuffer, ArrayBuffer, DataView, Atomics, arrow-function, let, TypedArray, for-of] features: [SharedArrayBuffer, ArrayBuffer, DataView, Atomics, arrow-function, let, TypedArray, for-of]
---*/ ---*/
var sab = new SharedArrayBuffer(4); var sab = new SharedArrayBuffer(8);
var views = [Int8Array, Uint8Array, Int16Array, Uint16Array, Int32Array, Uint32Array]; var views = [Int8Array, Uint8Array, Int16Array, Uint16Array, Int32Array, Uint32Array];
if (typeof BigInt !== "undefined") {
views.push(BigInt64Array);
views.push(BigUint64Array);
}
testWithTypedArrayConstructors(function(View) { testWithTypedArrayConstructors(function(View) {
let view = new View(sab); let view = new View(sab);
testWithAtomicsOutOfBoundsIndices(function(IdxGen) { testWithAtomicsOutOfBoundsIndices(function(IdxGen) {

View File

@ -13,6 +13,11 @@ var ab = new ArrayBuffer(16);
var int_views = [Int8Array, Uint8Array, Int16Array, Uint16Array, Int32Array, Uint32Array]; var int_views = [Int8Array, Uint8Array, Int16Array, Uint16Array, Int32Array, Uint32Array];
if (typeof BigInt !== "undefined") {
int_views.push(BigInt64Array);
int_views.push(BigUint64Array);
}
testWithTypedArrayConstructors(function(View) { testWithTypedArrayConstructors(function(View) {
var view = new View(ab); var view = new View(ab);

View File

@ -10,9 +10,14 @@ includes: [testAtomics.js, testTypedArray.js]
features: [SharedArrayBuffer, ArrayBuffer, DataView, Atomics, arrow-function, let, TypedArray, for-of] features: [SharedArrayBuffer, ArrayBuffer, DataView, Atomics, arrow-function, let, TypedArray, for-of]
---*/ ---*/
var sab = new SharedArrayBuffer(4); var sab = new SharedArrayBuffer(8);
var views = [Int8Array, Uint8Array, Int16Array, Uint16Array, Int32Array, Uint32Array]; var views = [Int8Array, Uint8Array, Int16Array, Uint16Array, Int32Array, Uint32Array];
if (typeof BigInt !== "undefined") {
views.push(BigInt64Array);
views.push(BigUint64Array);
}
testWithTypedArrayConstructors(function(View) { testWithTypedArrayConstructors(function(View) {
let view = new View(sab); let view = new View(sab);
testWithAtomicsOutOfBoundsIndices(function(IdxGen) { testWithAtomicsOutOfBoundsIndices(function(IdxGen) {

View File

@ -13,6 +13,11 @@ var ab = new ArrayBuffer(16);
var int_views = [Int8Array, Uint8Array, Int16Array, Uint16Array, Int32Array, Uint32Array]; var int_views = [Int8Array, Uint8Array, Int16Array, Uint16Array, Int32Array, Uint32Array];
if (typeof BigInt !== "undefined") {
int_views.push(BigInt64Array);
int_views.push(BigUint64Array);
}
testWithTypedArrayConstructors(function(View) { testWithTypedArrayConstructors(function(View) {
var view = new View(ab); var view = new View(ab);

View File

@ -10,9 +10,14 @@ includes: [testAtomics.js, testTypedArray.js]
features: [SharedArrayBuffer, ArrayBuffer, DataView, Atomics, arrow-function, let, TypedArray, for-of] features: [SharedArrayBuffer, ArrayBuffer, DataView, Atomics, arrow-function, let, TypedArray, for-of]
---*/ ---*/
var sab = new SharedArrayBuffer(4); var sab = new SharedArrayBuffer(8);
var views = [Int8Array, Uint8Array, Int16Array, Uint16Array, Int32Array, Uint32Array]; var views = [Int8Array, Uint8Array, Int16Array, Uint16Array, Int32Array, Uint32Array];
if (typeof BigInt !== "undefined") {
views.push(BigInt64Array);
views.push(BigUint64Array);
}
testWithTypedArrayConstructors(function(View) { testWithTypedArrayConstructors(function(View) {
let view = new View(sab); let view = new View(sab);
testWithAtomicsOutOfBoundsIndices(function(IdxGen) { testWithAtomicsOutOfBoundsIndices(function(IdxGen) {

View File

@ -13,6 +13,11 @@ var ab = new ArrayBuffer(16);
var int_views = [Int8Array, Uint8Array, Int16Array, Uint16Array, Int32Array, Uint32Array]; var int_views = [Int8Array, Uint8Array, Int16Array, Uint16Array, Int32Array, Uint32Array];
if (typeof BigInt !== "undefined") {
int_views.push(BigInt64Array);
int_views.push(BigUint64Array);
}
testWithTypedArrayConstructors(function(View) { testWithTypedArrayConstructors(function(View) {
var view = new View(ab); var view = new View(ab);

View File

@ -6,16 +6,23 @@
esid: sec-atomics.wait esid: sec-atomics.wait
description: > description: >
Test range checking of Atomics.wait on arrays that allow atomic operations Test range checking of Atomics.wait on arrays that allow atomic operations
includes: [testAtomics.js] includes: [testAtomics.js, testTypedArray.js]
features: [SharedArrayBuffer, ArrayBuffer, DataView, Atomics, arrow-function, let, for-of] features: [SharedArrayBuffer, ArrayBuffer, DataView, Atomics, TypedArray, arrow-function, let, for-of]
---*/ ---*/
var sab = new SharedArrayBuffer(4); var sab = new SharedArrayBuffer(8);
var view = new Int32Array(sab); var views = [Int32Array];
testWithAtomicsOutOfBoundsIndices(function(IdxGen) { if (typeof BigInt !== "undefined") {
views.push(BigInt64Array);
}
testWithTypedArrayConstructors(function(View) {
let view = new View(sab);
testWithAtomicsOutOfBoundsIndices(function(IdxGen) {
let Idx = IdxGen(view); let Idx = IdxGen(view);
assert.throws(RangeError, () => Atomics.wait(view, Idx, 10, 0)); // Even with zero timeout assert.throws(RangeError, () => Atomics.wait(view, Idx, 10, 0)); // Even with zero timeout
}); });
}, views);
reportCompare(0, 0); reportCompare(0, 0);

View File

@ -13,6 +13,11 @@ var ab = new ArrayBuffer(16);
var int_views = [Int8Array, Uint8Array, Int16Array, Uint16Array, Int32Array, Uint32Array]; var int_views = [Int8Array, Uint8Array, Int16Array, Uint16Array, Int32Array, Uint32Array];
if (typeof BigInt !== "undefined") {
int_views.push(BigInt64Array);
int_views.push(BigUint64Array);
}
testWithTypedArrayConstructors(function(View) { testWithTypedArrayConstructors(function(View) {
var view = new View(ab); var view = new View(ab);

View File

@ -6,16 +6,23 @@
esid: sec-atomics.wake esid: sec-atomics.wake
description: > description: >
Test range checking of Atomics.wake on arrays that allow atomic operations Test range checking of Atomics.wake on arrays that allow atomic operations
includes: [testAtomics.js] includes: [testAtomics.js, testTypedArray.js]
features: [SharedArrayBuffer, ArrayBuffer, DataView, Atomics, arrow-function, let, for-of] features: [SharedArrayBuffer, ArrayBuffer, DataView, Atomics, TypedArray, arrow-function, let, for-of]
---*/ ---*/
var sab = new SharedArrayBuffer(4); var sab = new SharedArrayBuffer(8);
var view = new Int32Array(sab); var views = [Int32Array];
testWithAtomicsOutOfBoundsIndices(function(IdxGen) { if (typeof BigInt !== "undefined") {
views.push(BigInt64Array);
}
testWithTypedArrayConstructors(function(View) {
let view = new View(sab);
testWithAtomicsOutOfBoundsIndices(function(IdxGen) {
let Idx = IdxGen(view); let Idx = IdxGen(view);
assert.throws(RangeError, () => Atomics.wake(view, Idx, 0)); // Even with waking zero assert.throws(RangeError, () => Atomics.wake(view, Idx, 0)); // Even with waking zero
}); });
}, views);
reportCompare(0, 0); reportCompare(0, 0);

View File

@ -13,6 +13,11 @@ var ab = new ArrayBuffer(16);
var int_views = [Int8Array, Uint8Array, Int16Array, Uint16Array, Int32Array, Uint32Array]; var int_views = [Int8Array, Uint8Array, Int16Array, Uint16Array, Int32Array, Uint32Array];
if (typeof BigInt !== "undefined") {
int_views.push(BigInt64Array);
int_views.push(BigUint64Array);
}
testWithTypedArrayConstructors(function(View) { testWithTypedArrayConstructors(function(View) {
var view = new View(ab); var view = new View(ab);

View File

@ -10,9 +10,14 @@ includes: [testAtomics.js, testTypedArray.js]
features: [SharedArrayBuffer, ArrayBuffer, DataView, Atomics, arrow-function, let, TypedArray, for-of] features: [SharedArrayBuffer, ArrayBuffer, DataView, Atomics, arrow-function, let, TypedArray, for-of]
---*/ ---*/
var sab = new SharedArrayBuffer(4); var sab = new SharedArrayBuffer(8);
var views = [Int8Array, Uint8Array, Int16Array, Uint16Array, Int32Array, Uint32Array]; var views = [Int8Array, Uint8Array, Int16Array, Uint16Array, Int32Array, Uint32Array];
if (typeof BigInt !== "undefined") {
views.push(BigInt64Array);
views.push(BigUint64Array);
}
testWithTypedArrayConstructors(function(View) { testWithTypedArrayConstructors(function(View) {
let view = new View(sab); let view = new View(sab);
testWithAtomicsOutOfBoundsIndices(function(IdxGen) { testWithAtomicsOutOfBoundsIndices(function(IdxGen) {

View File

@ -13,6 +13,11 @@ var ab = new ArrayBuffer(16);
var int_views = [Int8Array, Uint8Array, Int16Array, Uint16Array, Int32Array, Uint32Array]; var int_views = [Int8Array, Uint8Array, Int16Array, Uint16Array, Int32Array, Uint32Array];
if (typeof BigInt !== "undefined") {
int_views.push(BigInt64Array);
int_views.push(BigUint64Array);
}
testWithTypedArrayConstructors(function(View) { testWithTypedArrayConstructors(function(View) {
var view = new View(ab); var view = new View(ab);

View File

@ -0,0 +1,31 @@
// Copyright (C) 2018 Viktor Mukhachev. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-date.utc
description: non-integer values are converted to integers using `ToInteger`
info: |
[...]
Return TimeClip(MakeDate(MakeDay(yr, m, dt), MakeTime(h, min, s, milli))).
#sec-timeclip
Let clippedTime be ! ToInteger(time).
#sec-makeday
Let y be ! ToInteger(year).
Let m be ! ToInteger(month).
Let dt be ! ToInteger(date).
#sec-maketime
Let h be ! ToInteger(hour).
Let m be ! ToInteger(min).
Let s be ! ToInteger(sec).
Let milli be ! ToInteger(ms).
---*/
assert.sameValue(Date.UTC(1970.9, 0.9, 1.9, 0.9, 0.9, 0.9, 0.9), 0, 'positive non-integer values');
assert.sameValue(Date.UTC(-1970.9, -0.9, -0.9, -0.9, -0.9, -0.9, -0.9), -124334438400000, 'negative non-integer values');
reportCompare(0, 0);

View File

@ -40,3 +40,6 @@ var date_1999_end = 946684799999;
var date_2000_start = 946684800000; var date_2000_start = 946684800000;
var date_2099_end = 4102444799999; var date_2099_end = 4102444799999;
var date_2100_start = 4102444800000; var date_2100_start = 4102444800000;
var start_of_time = -8.64e15;
var end_of_time = 8.64e15;

View File

@ -13,7 +13,6 @@ info: |
exception. exception.
... ...
includes: [propertyHelper.js]
features: [Symbol] features: [Symbol]
---*/ ---*/

View File

@ -10,7 +10,6 @@ info: |
Number.NEGATIVE_INFINITY Number.NEGATIVE_INFINITY
The value of Number.NEGATIVE_INFINITY is -. The value of Number.NEGATIVE_INFINITY is -.
includes: [propertyHelper.js]
---*/ ---*/
assert.sameValue(Number.NEGATIVE_INFINITY, -Infinity); assert.sameValue(Number.NEGATIVE_INFINITY, -Infinity);

View File

@ -10,7 +10,6 @@ info: |
Number.POSITIVE_INFINITY Number.POSITIVE_INFINITY
The value of Number.POSITIVE_INFINITY is +. The value of Number.POSITIVE_INFINITY is +.
includes: [propertyHelper.js]
---*/ ---*/
assert.sameValue(Number.POSITIVE_INFINITY, Infinity); assert.sameValue(Number.POSITIVE_INFINITY, Infinity);

View File

@ -1,10 +1,10 @@
// Copyright (C) 2013 the V8 project authors. All rights reserved. // Copyright (C) 2013 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file. // This code is governed by the BSD license found in the LICENSE file.
/*--- /*---
es6id: 7.2. esid: sec-object.is
description: > description: >
Object.is/SameValue: Symbol Object.is/SameValue: Symbol
features: [Symbol] features: [Object.is,Symbol]
---*/ ---*/
var symA = Symbol('66'); var symA = Symbol('66');
var symB = Symbol('66'); var symB = Symbol('66');

View File

@ -7,7 +7,6 @@ info: |
es6id: S25.4.4.1_A8.1_T1 es6id: S25.4.4.1_A8.1_T1
author: Sam Mikes author: Sam Mikes
description: Promise.all() rejects when a promise in its array rejects description: Promise.all() rejects when a promise in its array rejects
includes: [promiseHelper.js]
flags: [async] flags: [async]
---*/ ---*/

View File

@ -7,7 +7,6 @@ info: |
es6id: S25.4.4.1_A8.2_T2 es6id: S25.4.4.1_A8.2_T2
author: Sam Mikes author: Sam Mikes
description: Promise.all() rejects when second promise in array rejects description: Promise.all() rejects when second promise in array rejects
includes: [promiseHelper.js]
flags: [async] flags: [async]
---*/ ---*/

View File

@ -27,6 +27,7 @@ target.then = function(a, b) {
}; };
var originalFinallyHandler = function () {}; var originalFinallyHandler = function () {};
var anonName = Object(function () {}).name;
var result = Promise.prototype.finally.call(target, originalFinallyHandler, 2, 3); var result = Promise.prototype.finally.call(target, originalFinallyHandler, 2, 3);
@ -43,12 +44,17 @@ assert.sameValue(
'Invokes `then` method with a function as the first argument' 'Invokes `then` method with a function as the first argument'
); );
assert.notSameValue(firstArg, originalFinallyHandler, 'Invokes `then` method with a different fulfillment handler'); assert.notSameValue(firstArg, originalFinallyHandler, 'Invokes `then` method with a different fulfillment handler');
assert.sameValue(firstArg.length, 1, 'fulfillment handler has a length of 1');
assert.sameValue(firstArg.name, anonName, 'fulfillment handler is anonymous');
assert.sameValue( assert.sameValue(
typeof secondArg, typeof secondArg,
'function', 'function',
'Invokes `then` method with a function as the second argument' 'Invokes `then` method with a function as the second argument'
); );
assert.notSameValue(secondArg, originalFinallyHandler, 'Invokes `then` method with a different fulfillment handler'); assert.notSameValue(secondArg, originalFinallyHandler, 'Invokes `then` method with a different rejection handler');
assert.sameValue(secondArg.length, 1, 'rejection handler has a length of 1');
assert.sameValue(secondArg.name, anonName, 'rejection handler is anonymous');
assert.sameValue(result, returnValue, 'Returns the result of the invocation of `then`'); assert.sameValue(result, returnValue, 'Returns the result of the invocation of `then`');

View File

@ -2,7 +2,7 @@
// This code is governed by the BSD license found in the LICENSE file. // This code is governed by the BSD license found in the LICENSE file.
/*--- /*---
author: Sathya Gunasekaran author: Sathya Gunasekaran
description: finally calls the SpeciesConstructor description: finally calls the SpeciesConstructor and creates the right amount of promises
esid: sec-promise.prototype.finally esid: sec-promise.prototype.finally
features: [Promise.prototype.finally] features: [Promise.prototype.finally]
flags: [async] flags: [async]
@ -22,4 +22,4 @@ new FooPromise(r => r())
.then(() => { .then(() => {
assert.sameValue(count, 6, "6 new promises were created"); assert.sameValue(count, 6, "6 new promises were created");
$DONE(); $DONE();
}); }, $ERROR);

View File

@ -0,0 +1,22 @@
// Copyright (C) 2018 Jordan Harband. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
author: Jordan Harband
description: Promise subclass finally on rejected creates the proper number of subclassed promises
esid: sec-promise.prototype.finally
features: [Promise.prototype.finally]
flags: [async]
---*/
var count = 0;
class FooPromise extends Promise {
constructor(resolve, reject) {
count++;
return super(resolve, reject);
}
}
FooPromise.reject().finally(() => {}).then($ERROR).catch(() => {
assert.sameValue(7, count);
$DONE();
});

View File

@ -0,0 +1,22 @@
// Copyright (C) 2018 Jordan Harband. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
author: Jordan Harband
description: Promise subclass finally on resolved creates the proper number of subclassed promises
esid: sec-promise.prototype.finally
features: [Promise.prototype.finally]
flags: [async]
---*/
var count = 0;
class FooPromise extends Promise {
constructor(resolve, reject) {
count++;
return super(resolve, reject);
}
}
FooPromise.resolve().finally(() => {}).then(() => {
assert.sameValue(6, count);
$DONE();
}, $ERROR);

View File

@ -0,0 +1,19 @@
// Copyright (C) 2018 Jordan Harband. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
author: Jordan Harband
description: finally on rejected Promise calls the SpeciesConstructor
esid: sec-promise.prototype.finally
features: [Promise.prototype.finally]
---*/
class FooPromise extends Promise {
static get [Symbol.species]() { return Promise; }
}
var p = Promise.reject().finally(() => FooPromise.reject());
assert.sameValue(p instanceof Promise, true);
assert.sameValue(p instanceof FooPromise, false);
reportCompare(0, 0);

View File

@ -0,0 +1,19 @@
// Copyright (C) 2018 Jordan Harband. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
author: Jordan Harband
description: finally on resolved Promise calls the SpeciesConstructor
esid: sec-promise.prototype.finally
features: [Promise.prototype.finally]
---*/
class FooPromise extends Promise {
static get [Symbol.species]() { return Promise; }
}
var p = Promise.resolve().finally(() => FooPromise.resolve());
assert.sameValue(p instanceof Promise, true);
assert.sameValue(p instanceof FooPromise, false);
reportCompare(0, 0);

View File

@ -0,0 +1,19 @@
// Copyright (C) 2018 Jordan Harband. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
author: Jordan Harband
description: >
Promise.prototype.finally called with a non-branded Promise does not throw
esid: sec-promise.prototype.finally
features: [Promise.prototype.finally]
---*/
var called = false;
var p = new Proxy(Promise.resolve(), {});
var oldThen = Promise.prototype.then;
Promise.prototype.then = () => { called = true; };
Promise.prototype.finally.call(p);
assert.sameValue(called, true);
Promise.prototype.then = oldThen;
reportCompare(0, 0);

View File

@ -7,12 +7,9 @@ info: |
es6id: S25.4.4.5 es6id: S25.4.4.5
author: Sam Mikes author: Sam Mikes
description: Promise.resolve delegates to foreign thenable description: Promise.resolve delegates to foreign thenable
includes: [promiseHelper.js]
flags: [async] flags: [async]
---*/ ---*/
var sequence = [];
var thenable = { var thenable = {
then: function(onResolve, onReject) { then: function(onResolve, onReject) {
return onResolve('resolved'); return onResolve('resolved');

View File

@ -5,7 +5,6 @@
/*--- /*---
description: > description: >
Test the groups object on RegExp subclass results that do not have their own. Test the groups object on RegExp subclass results that do not have their own.
includes: [propertyHelper.js]
esid: sec-regexpbuiltinexec esid: sec-regexpbuiltinexec
features: [regexp-named-groups] features: [regexp-named-groups]
info: | info: |
@ -28,11 +27,11 @@ class FakeRegExp extends RegExp {
const re = new FakeRegExp(); const re = new FakeRegExp();
const result = re.exec("ab"); const result = re.exec("ab");
assert.sameValue(result.__proto__, Array.prototype); assert.sameValue(Object.getPrototypeOf(result), Array.prototype);
assert.sameValue(false, result.hasOwnProperty("groups")); assert.sameValue(false, result.hasOwnProperty("groups"));
Array.prototype.groups = { a: "b" }; Array.prototype.groups = { a: "b" };
Array.prototype.groups.__proto__.b = "c"; Object.getPrototypeOf(Array.prototype.groups).b = "c";
assert.sameValue("b", "ab".replace(re, "$<a>")); assert.sameValue("b", "ab".replace(re, "$<a>"));
assert.sameValue("c", "ab".replace(re, "$<b>")); assert.sameValue("c", "ab".replace(re, "$<b>"));
Array.prototype.groups = undefined; Array.prototype.groups = undefined;

View File

@ -5,7 +5,6 @@
/*--- /*---
description: > description: >
Test the groups object on RegExp subclass results that have their own. Test the groups object on RegExp subclass results that have their own.
includes: [propertyHelper.js]
esid: sec-regexpbuiltinexec esid: sec-regexpbuiltinexec
features: [regexp-named-groups] features: [regexp-named-groups]
info: | info: |
@ -22,14 +21,14 @@ class FakeRegExp extends RegExp {
const fakeResult = ["ab", "a"]; const fakeResult = ["ab", "a"];
fakeResult.index = 0; fakeResult.index = 0;
fakeResult.groups = { a: "b" }; fakeResult.groups = { a: "b" };
fakeResult.groups.__proto__.b = "c"; Object.getPrototypeOf(fakeResult.groups).b = "c";
return fakeResult; return fakeResult;
} }
}; };
const re = new FakeRegExp(); const re = new FakeRegExp();
const result = re.exec("ab"); const result = re.exec("ab");
assert.sameValue(result.__proto__, Array.prototype); assert.sameValue(Object.getPrototypeOf(result), Array.prototype);
assert(result.hasOwnProperty("groups")); assert(result.hasOwnProperty("groups"));
assert.sameValue("b", result.groups.a); assert.sameValue("b", result.groups.a);
assert.sameValue("b", "ab".replace(re, "$<a>")); assert.sameValue("b", "ab".replace(re, "$<a>"));

View File

@ -18,7 +18,7 @@ info: |
const re = /./; const re = /./;
const result = re.exec("a"); const result = re.exec("a");
assert.sameValue(result.__proto__, Array.prototype); assert.sameValue(Object.getPrototypeOf(result), Array.prototype);
assert(result.hasOwnProperty("groups")); assert(result.hasOwnProperty("groups"));
assert.sameValue("a", result[0]); assert.sameValue("a", result[0]);
assert.sameValue(0, result.index); assert.sameValue(0, result.index);

View File

@ -5,7 +5,6 @@
/*--- /*---
description: > description: >
Test the groups object with matched and unmatched named captures. Test the groups object with matched and unmatched named captures.
includes: [propertyHelper.js]
esid: sec-regexpbuiltinexec esid: sec-regexpbuiltinexec
features: [regexp-named-groups] features: [regexp-named-groups]
info: | info: |
@ -19,7 +18,7 @@ info: |
const re = /(?<a>a).|(?<x>x)/; const re = /(?<a>a).|(?<x>x)/;
const result = re.exec("ab"); const result = re.exec("ab");
assert.sameValue(result.__proto__, Array.prototype); assert.sameValue(Object.getPrototypeOf(result), Array.prototype);
assert(result.hasOwnProperty("groups")); assert(result.hasOwnProperty("groups"));
assert.sameValue("ab", result[0]); assert.sameValue("ab", result[0]);
assert.sameValue("a", result[1]); assert.sameValue("a", result[1]);

View File

@ -0,0 +1,33 @@
// Copyright (C) 2017 Valerie Young. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-string.prototype.trimEnd
description: >
String.prototype.trimEnd.length is 0.
info: >
String.prototype.trimEnd ( )
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]
features: [string-trimming, String.prototype.trimEnd]
---*/
verifyProperty(String.prototype.trimEnd, "length", {
value: 0,
enumerable: false,
writable: false,
configurable: true,
});
reportCompare(0, 0);

View File

@ -0,0 +1,30 @@
// Copyright (C) 2017 Valerie Young. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-string.prototype.trimEnd
description: >
String.prototype.trimEnd.name is "trimEnd".
info: >
String.prototype.trimEnd ( )
17 ECMAScript Standard Built-in Objects:
Every built-in Function object, including constructors, that is not
identified as an anonymous function has a name property whose value
is a String.
Unless otherwise specified, the name property of a built-in Function
object, if it exists, has the attributes { [[Writable]]: false,
[[Enumerable]]: false, [[Configurable]]: true }.
includes: [propertyHelper.js]
features: [string-trimming, String.prototype.trimEnd]
---*/
verifyProperty(String.prototype.trimEnd, "name", {
value: "trimEnd",
enumerable: false,
writable: false,
configurable: true,
});
reportCompare(0, 0);

View File

@ -0,0 +1,24 @@
// Copyright (C) 2017 The Valerie Young. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-string.prototype.trimEnd
description: >
"trimEnd" property of String.prototype
info: >
17 ECMAScript Standard Built-in Objects:
Every other data property described in clauses 18 through 26 and in Annex B.2
has the attributes { [[Writable]]: true, [[Enumerable]]: false,
[[Configurable]]: true } unless otherwise specified.
includes: [propertyHelper.js]
features: [string-trimming, String.prototype.trimEnd]
---*/
verifyProperty(String.prototype, "trimEnd", {
enumerable: false,
writable: true,
configurable: true,
});
reportCompare(0, 0);

View File

@ -0,0 +1,33 @@
// Copyright (c) 2017 Valerie Young. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-string.prototype.trimEnd
description: Behavior when "this" value is a boolean.
info: |
Runtime Semantics: TrimString ( string, where )
2. Let S be ? ToString(str).
ToString ( argument )
Argument Type: Boolean
Result:
If argument is true, return "true".
If argument is false, return "false".
features: [string-trimming, String.prototype.trimEnd]
---*/
var trimEnd = String.prototype.trimEnd
assert.sameValue(
trimEnd.call(true),
'true',
'String.prototype.trimEnd.call(true)'
);
assert.sameValue(
String.prototype.trimEnd.call(false),
'false',
'String.prototype.trimEnd.call(false)'
);
reportCompare(0, 0);

View File

@ -0,0 +1,32 @@
// Copyright (c) 2017 Valerie Young. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-string.prototype.trimEnd
description: TrimEnd removes all line terminators from the end of a string.
info: |
Runtime Symantics: TrimString ( string, where )
...
4. Else if where is "end", let T be a String value that is a copy of S with
trailing white space removed.
...
The definition of white space is the union of WhiteSpace and LineTerminator.
features: [string-trimming, String.prototype.trimEnd]
---*/
var trimEnd = String.prototype.trimEnd;
// A string of all valid LineTerminator Unicode code points
var lt = '\u000A\u000D\u2028\u2029';
var str = lt + 'a' + lt + 'b' + lt;
var expected = lt + 'a' + lt + 'b';
assert.sameValue(
trimEnd.call(str),
expected,
);
reportCompare(0, 0);

View File

@ -0,0 +1,24 @@
// Copyright (C) 2017 Valerie Young. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-string.prototype.trimEnd
description: The "this" value must be object-coercible
info: |
1. Let O be ? RequireObjectCoercible(this value).
features: [string-trimming, String.prototype.trimEnd]
---*/
var trimEnd = String.prototype.trimEnd;
assert.sameValue(typeof trimEnd, 'function');
assert.throws(TypeError, function() {
trimEnd.call(undefined);
}, 'undefined');
assert.throws(TypeError, function() {
trimEnd.call(null);
}, 'null');
reportCompare(0, 0);

View File

@ -0,0 +1,50 @@
// Copyright (c) 2017 Valerie Young. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-string.prototype.trimEnd
description: Behavoir when "this" value is a number.
info: |
Runtime Semantics: TrimString ( string, where )
2. Let S be ? ToString(str).
ToString ( argument )
Argument Type: Number
Result: NumberToString(argument)
features: [string-trimming, String.prototype.trimEnd]
---*/
var trimEnd = String.prototype.trimEnd
assert.sameValue(
trimEnd.call(NaN),
'NaN',
'String.prototype.trimEnd.call(NaN)'
);
assert.sameValue(
trimEnd.call(Infinity),
'Infinity',
'String.prototype.trimEnd.call(Infinity)'
);
assert.sameValue(
trimEnd.call(-0),
'0',
'String.prototype.trimEnd.call(-0)'
);
assert.sameValue(
trimEnd.call(1),
'1',
'String.prototype.trimEnd.call(1)'
);
assert.sameValue(
trimEnd.call(-1),
'-1',
'String.prototype.trimEnd.call(-1)'
);
reportCompare(0, 0);

View File

@ -0,0 +1,59 @@
// Copyright (C) 2017 Valerie Young. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-string.prototype.trimEnd
description: >
This value is an object which cannot be converted to a primitive
info: |
Runtime Semantics: TrimString ( string, where )
1. Let str be ? RequireObjectCoercible(string).
2. Let S be ? ToString(str).
...
ToString ( argument )
If argument is Object:
1. Let primValue be ? ToPrimitive(argument, hint String).
...
ToPrimitive ( input [, PreferredType ])
...
b. Else if PreferredType is hint String, let hint be "string".
...
d. Let exoticToPrim be ? GetMethod(input, @@toPrimitive)
e. If exoticToPrim is not undefined, then
i. Let result be ? Call(exoticToPrim, input, « hint »).
ii. If Type(result) is not Object, return result.
iii. Throw a TypeError exception.
f. If hint is "default", set hint to "number".
g. Return ? OrdinaryToPrimitive(input, hint).
...
OrdinaryToPrimitive( O, hint )
...
3. If hint is "string", then
a. Let methodNames be « "toString", "valueOf" ».
...
5. For each name in methodNames in List order, do
a. Let method be ? Get(O, name).
b. If IsCallable(method) is true, then
i. Let result be ? Call(method, O).
ii. If Type(result) is not Object, return result.
6. Throw a TypeError exception.
features: [string-trimming, String.prototype.trimEnd, Symbol.toPrimitive]
---*/
var thisVal = {
[Symbol.toPrimitive]: undefined,
toString: undefined,
valueOf: undefined,
};
// If trimEnd is called on an object with neither Symbol.toPrimitive, toString
// nor valueOf defined, then a TypeError exception should be thrown.
assert.throws(
TypeError,
function() { String.prototype.trimEnd.call(thisVal); },
);
reportCompare(0, 0);

View File

@ -0,0 +1,36 @@
// Copyright (C) 2017 Valerie Young. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-string.prototype.trimEnd
description: >
Abrupt completion when getting Symbol.toPrimitive method
info: |
Runtime Semantics: TrimString ( string, where )
1. Let str be ? RequireObjectCoercible(string).
2. Let S be ? ToString(str).
...
ToString ( argument )
If argument is Object:
1. Let primValue be ? ToPrimitive(argument, hint String).
...
ToPrimitive ( input [, PreferredType ])
...
d. Let exoticToPrim be ? GetMethod(input, @@toPrimitive).
...
features: [string-trimming, String.prototype.trimEnd, Symbol.toPrimitive]
---*/
var thisVal = {
get [Symbol.toPrimitive]() {
throw new Test262Error();
},
};
assert.throws(Test262Error, function() {
String.prototype.trimEnd.call(thisVal);
});
reportCompare(0, 0);

View File

@ -0,0 +1,38 @@
// Copyright (C) 2017 Valerie Young. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-string.prototype.trimEnd
description: >
Abrupt completion when Symbol.toPrimitive abrupt completes.
info: |
Runtime Semantics: TrimString ( string, where )
1. Let str be ? RequireObjectCoercible(string).
2. Let S be ? ToString(str).
...
ToString ( argument )
If argument is Object:
1. Let primValue be ? ToPrimitive(argument, hint String).
...
ToPrimitive ( input [, PreferredType ])
...
d. Let exoticToPrim be ? GetMethod(input, @@toPrimitive).
e. If exoticToPrim is not undefined, then
i. Let result be ? Call(exoticToPrim, input, « hint »).
...
features: [string-trimming, String.prototype.trimEnd, Symbol.toPrimitive]
---*/
var thisVal = {
[Symbol.toPrimitive]: function() {
throw new Test262Error();
},
};
assert.throws(Test262Error, function() {
String.prototype.trimEnd.call(thisVal);
});
reportCompare(0, 0);

View File

@ -0,0 +1,76 @@
// Copyright (C) 2017 Valerie Young. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-string.prototype.trimEnd
description: >
Priority of Symbol[toPrimitive] when converting object to string for trimming
info: |
Runtime Semantics: TrimString ( string, where )
1. Let str be ? RequireObjectCoercible(string).
2. Let S be ? ToString(str).
...
ToString ( argument )
If argument is Object:
1. Let primValue be ? ToPrimitive(argument, hint String).
...
ToPrimitive ( input [, PreferredType ])
...
d. Let exoticToPrim be ? GetMethod(input, @@toPrimitive)
e. If exoticToPrim is not undefined, then
i. Let result be ? Call(exoticToPrim, input, « hint »).
ii. If Type(result) is not Object, return result.
...
features: [string-trimming, String.prototype.trimEnd, Symbol.toPrimitive]
---*/
var toPrimitiveAccessed = 0;
var toStringAccessed = 0;
var valueOfAccessed = 0;
var thisVal = {
get [Symbol.toPrimitive]() {
toPrimitiveAccessed += 1;
return function() { return '42 '; };
},
get toString() {
toStringAccessed += 1;
return function() { return ''; };
},
get valueOf() {
valueOfAccessed += 1;
return function() { return ''; };
},
};
// Test that thisVal[Symbol.toPrimitive] has been called.
var result = String.prototype.trimEnd.call(thisVal);
assert.sameValue(
toPrimitiveAccessed,
1,
'thisVal[Symbol.toPrimitive] expected to have been accessed.'
);
assert.sameValue(
result,
'42',
'thisVal[Symbol.toPrimitive] expected to have been called.',
);
// Test that thisVal.toString and thisVal.valueOf have not been accessedo
assert.sameValue(
toStringAccessed,
0,
'thisVal.toString should not have been accessed.'
);
assert.sameValue(
valueOfAccessed,
0,
'thisVal.valueOf should not have been accessed.'
);
reportCompare(0, 0);

View File

@ -0,0 +1,40 @@
// Copyright (C) 2017 Valerie Young. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-string.prototype.trimEnd
description: >
Abrupt completion when Symbol.toPrimitive returns an object
info: |
Runtime Semantics: TrimString ( string, where )
1. Let str be ? RequireObjectCoercible(string).
2. Let S be ? ToString(str).
...
ToString ( argument )
If arguement is Object:
1. Let primValue be ? ToPrimitive(argument, hint String).
...
ToPrimitive ( input [, PreferredType ])
...
d. Let exoticToPrim be ? GetMethod(input, @@toPrimitive).
e. If exoticToPrim is not undefined, then
i. Let result be ? Call(exoticToPrim, input, « hint »).
ii. If Type(result) is not Object, return result.
iii. Throw a TypeError exception.
...
features: [string-trimming, String.prototype.trimEnd, Symbol.toPrimitive]
---*/
var thisVal = {
[Symbol.toPrimitive]: function() {
return {};
},
};
assert.throws(TypeError, function() {
String.prototype.trimEnd.call(thisVal);
});
reportCompare(0, 0);

View File

@ -0,0 +1,53 @@
// Copyright (C) 2017 Valerie Young. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-string.prototype.trimEnd
description: >
Abrupt completion when getting toString method
info: |
Runtime Semantics: TrimString ( string, where )
1. Let str be ? RequireObjectCoercible(string).
2. Let S be ? ToString(str).
...
ToString ( argument )
If argument is Object:
1. Let primValue be ? ToPrimitive(argument, hint String).
...
ToPrimitive ( input [, PreferredType ])
...
b. Else if PreferredType is hint String, let hint be "string".
...
d. Let exoticToPrim be ? GetMethod(input, @@toPrimitive)
e. If exoticToPrim is not undefined, then
i. Let result be ? Call(exoticToPrim, input, « hint »).
ii. If Type(result) is not Object, return result.
iii. Throw a TypeError exception.
f. If hint is "default", set hint to "number".
g. Return ? OrdinaryToPrimitive(input, hint).
...
OrdinaryToPrimitive( O, hint )
...
3. If hint is "string", then
a. Let methodNames be « "toString", "valueOf" ».
...
5. For each name in methodNames in List order, do
a. Let method be ? Get(O, name).
features: [string-trimming, String.prototype.trimEnd, Symbol.toPrimitive]
---*/
var thisVal = {
[Symbol.toPrimitive]: undefined,
get toString() {
throw new Test262Error();
},
};
assert.throws(Test262Error, function() {
String.prototype.trimEnd.call(thisVal);
});
reportCompare(0, 0);

View File

@ -0,0 +1,55 @@
// Copyright (C) 2017 Valerie Young. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-string.prototype.trimEnd
description: >
Abrupt completion when toString called and abrupt completes.
info: |
Runtime Semantics: TrimString ( string, where )
1. Let str be ? RequireObjectCoercible(string).
2. Let S be ? ToString(str).
...
ToString ( argument )
If argument is Object:
1. Let primValue be ? ToPrimitive(argument, hint String).
...
ToPrimitive ( input [, PreferredType ])
...
b. Else if PreferredType is hint String, let hint be "string".
...
d. Let exoticToPrim be ? GetMethod(input, @@toPrimitive)
e. If exoticToPrim is not undefined, then
i. Let result be ? Call(exoticToPrim, input, « hint »).
ii. If Type(result) is not Object, return result.
iii. Throw a TypeError exception.
f. If hint is "default", set hint to "number".
g. Return ? OrdinaryToPrimitive(input, hint).
...
OrdinaryToPrimitive( O, hint )
...
3. If hint is "string", then
a. Let methodNames be « "toString", "valueOf" ».
...
5. For each name in methodNames in List order, do
a. Let method be ? Get(O, name).
b. If IsCallable(method) is true, then
i. Let result be ? Call(method, O).
features: [string-trimming, String.prototype.trimEnd, Symbol.toPrimitive]
---*/
var thisVal = {
[Symbol.toPrimitive]: undefined,
toString: function() {
throw new Test262Error();
},
};
assert.throws(Test262Error, function() {
String.prototype.trimEnd.call(thisVal);
});
reportCompare(0, 0);

View File

@ -0,0 +1,95 @@
// Copyright (C) 2017 Valerie Young. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-string.prototype.trimEnd
description: >
Priority of toString when converting object to string for trimming
info: |
Runtime Semantics: TrimString ( string, where )
1. Let str be ? RequireObjectCoercible(string).
2. Let S be ? ToString(str).
...
ToString ( argument )
If argument is Object:
1. Let primValue be ? ToPrimitive(argument, hint String).
...
ToPrimitive ( input [, PreferredType ])
...
b. Else if PreferredType is hint String, let hint be "string".
...
d. Let exoticToPrim be ? GetMethod(input, @@toPrimitive)
e. If exoticToPrim is not undefined, then
i. Let result be ? Call(exoticToPrim, input, « hint »).
ii. If Type(result) is not Object, return result.
iii. Throw a TypeError exception.
f. If hint is "default", set hint to "number".
g. Return ? OrdinaryToPrimitive(input, hint).
...
OrdinaryToPrimitive( O, hint )
...
3. If hint is "string", then
a. Let methodNames be « "toString", "valueOf" ».
...
5. For each name in methodNames in List order, do
a. Let method be ? Get(O, name).
b. If IsCallable(method) is true, then
i. Let result be ? Call(method, O).
ii. If Type(result) is not Object, return result.
...
features: [string-trimming, String.prototype.trimEnd, Symbol.toPrimitive]
---*/
var toPrimitiveAccessed = 0;
var toStringAccessed = 0;
var valueOfAccessed = 0;
var thisVal = {
get [Symbol.toPrimitive]() {
toPrimitiveAccessed +=1;
return undefined;
},
get toString() {
toStringAccessed += 1;
return function() { return '42 '; };
},
get valueOf() {
valueOfAccessed += 1;
return function() { return ''; };
},
};
// Test that toString is called when Symbol.toPrimitive is undefined.
var result = String.prototype.trimEnd.call(thisVal)
assert.sameValue(
toPrimitiveAccessed,
1,
'thisVal.toString expected to have been accessed.'
);
assert.sameValue(
result,
'42',
'thisVal.toString expected to have been called.',
);
// Test that thisVal[toPrimitive] has been accessed.
assert.sameValue(
toPrimitiveAccessed,
1,
'thisVal[Symbol.toPrimitive should have been accessed.'
);
// Test that thisVal.valueOf has not been accessed.
assert.sameValue(
valueOfAccessed,
0,
'thisVal.valueOf should not have been accessed.'
);
reportCompare(0, 0);

View File

@ -0,0 +1,58 @@
// Copyright (C) 2017 Valerie Young. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-string.prototype.trimEnd
description: >
Abrupt completion when toString called and returns an object
info: |
Runtime Semantics: TrimString ( string, where )
1. Let str be ? RequireObjectCoercible(string).
2. Let S be ? ToString(str).
...
ToString ( argument )
If argument is Object:
1. Let primValue be ? ToPrimitive(argument, hint String).
...
ToPrimitive ( input [, PreferredType ])
...
b. Else if PreferredType is hint String, let hint be "string".
...
d. Let exoticToPrim be ? GetMethod(input, @@toPrimitive)
e. If exoticToPrim is not undefined, then
i. Let result be ? Call(exoticToPrim, input, « hint »).
ii. If Type(result) is not Object, return result.
iii. Throw a TypeError exception.
f. If hint is "default", set hint to "number".
g. Return ? OrdinaryToPrimitive(input, hint).
...
OrdinaryToPrimitive( O, hint )
...
3. If hint is "string", then
a. Let methodNames be « "toString", "valueOf" ».
...
5. For each name in methodNames in List order, do
a. Let method be ? Get(O, name).
b. If IsCallable(method) is true, then
i. Let result be ? Call(method, O).
ii. If Type(result) is not Object, return result.
6. Throw a TypeError exception.
features: [string-trimming, String.prototype.trimEnd, Symbol.toPrimitive]
---*/
var thisVal = {
[Symbol.toPrimitive]: undefined,
toString: function() {
return {};
},
};
assert.throws(TypeError, function() {
String.prototype.trimEnd.call(thisVal);
});
reportCompare(0, 0);

View File

@ -0,0 +1,54 @@
// Copyright (C) 2017 Valerie Young. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-string.prototype.trimEnd
description: >
Abrupt completion when getting valueOf method
info: |
Runtime Semantics: TrimString ( string, where )
1. Let str be ? RequireObjectCoercible(string).
2. Let S be ? ToString(str).
...
ToString ( argument )
If argument is Object:
1. Let primValue be ? ToPrimitive(argument, hint String).
...
ToPrimitive ( input [, PreferredType ])
...
b. Else if PreferredType is hint String, let hint be "string".
...
d. Let exoticToPrim be ? GetMethod(input, @@toPrimitive)
e. If exoticToPrim is not undefined, then
i. Let result be ? Call(exoticToPrim, input, « hint »).
ii. If Type(result) is not Object, return result.
iii. Throw a TypeError exception.
f. If hint is "default", set hint to "number".
g. Return ? OrdinaryToPrimitive(input, hint).
...
OrdinaryToPrimitive( O, hint )
...
3. If hint is "string", then
a. Let methodNames be « "toString", "valueOf" ».
...
5. For each name in methodNames in List order, do
a. Let method be ? Get(O, name).
features: [string-trimming, String.prototype.trimEnd, Symbol.toPrimitive]
---*/
var thisVal = {
[Symbol.toPrimitive]: undefined,
toString: undefined,
get valueOf() {
throw new Test262Error();
},
};
assert.throws(Test262Error, function() {
String.prototype.trimEnd.call(thisVal);
});
reportCompare(0, 0);

View File

@ -0,0 +1,56 @@
// Copyright (C) 2017 Valerie Young. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-string.prototype.trimEnd
description: >
Abrupt completion when valueOf called and abrupt completes.
info: |
Runtime Semantics: TrimString ( string, where )
1. Let str be ? RequireObjectCoercible(string).
2. Let S be ? ToString(str).
...
ToString ( argument )
If argument is Object:
1. Let primValue be ? ToPrimitive(argument, hint String).
...
ToPrimitive ( input [, PreferredType ])
...
b. Else if PreferredType is hint String, let hint be "string".
...
d. Let exoticToPrim be ? GetMethod(input, @@toPrimitive)
e. If exoticToPrim is not undefined, then
i. Let result be ? Call(exoticToPrim, input, « hint »).
ii. If Type(result) is not Object, return result.
iii. Throw a TypeError exception.
f. If hint is "default", set hint to "number".
g. Return ? OrdinaryToPrimitive(input, hint).
...
OrdinaryToPrimitive( O, hint )
...
3. If hint is "string", then
a. Let methodNames be « "toString", "valueOf" ».
...
5. For each name in methodNames in List order, do
a. Let method be ? Get(O, name).
b. If IsCallable(method) is true, then
i. Let result be ? Call(method, O).
features: [string-trimming, String.prototype.trimEnd, Symbol.toPrimitive]
---*/
var thisVal = {
[Symbol.toPrimitive]: undefined,
toString: undefined,
valueOf: function() {
throw new Test262Error();
},
};
assert.throws(Test262Error, function() {
String.prototype.trimEnd.call(thisVal);
});
reportCompare(0, 0);

View File

@ -0,0 +1,93 @@
// Copyright (C) 2017 Valerie Young. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-string.prototype.trimEnd
description: >
Priority of valueOf when converting object to string for trimming
info: |
Runtime Semantics: TrimString ( string, where )
1. Let str be ? RequireObjectCoercible(string).
2. Let S be ? ToString(str).
...
ToString ( argument )
If argument is Object:
1. Let primValue be ? ToPrimitive(argument, hint String).
...
ToPrimitive ( input [, PreferredType ])
...
b. Else if PreferredType is hint String, let hint be "string".
...
d. Let exoticToPrim be ? GetMethod(input, @@toPrimitive)
e. If exoticToPrim is not undefined, then
i. Let result be ? Call(exoticToPrim, input, « hint »).
ii. If Type(result) is not Object, return result.
iii. Throw a TypeError exception.
f. If hint is "default", set hint to "number".
g. Return ? OrdinaryToPrimitive(input, hint).
...
OrdinaryToPrimitive( O, hint )
...
3. If hint is "string", then
a. Let methodNames be « "toString", "valueOf" ».
...
5. For each name in methodNames in List order, do
a. Let method be ? Get(O, name).
b. If IsCallable(method) is true, then
i. Let result be ? Call(method, O).
ii. If Type(result) is not Object, return result.
...
features: [string-trimming, String.prototype.trimEnd, Symbol.toPrimitive]
---*/
var toPrimitiveAccessed = 0;
var toStringAccessed = 0;
var valueOfAccessed = 0;
var thisVal = {
get [Symbol.toPrimitive]() {
toPrimitiveAccessed += 1;
return undefined;
},
get toString() {
toStringAccessed += 1;
return undefined;
},
get valueOf() {
valueOfAccessed += 1;
return function() { return '42 '; };
},
};
// Test that valueOf is called when Symbol.toPrimitive and toString are both
// undefined.
var result = String.prototype.trimEnd.call(thisVal);
assert.sameValue(
valueOfAccessed,
1,
'thisVal.toString expected to have been accessed.'
);
assert.sameValue(
result,
'42',
'thisVal.valueOf expected to have been called.',
);
// Test that thisVal[toPrimitive] and thisVal.toString has been accessed.
assert.sameValue(
toPrimitiveAccessed,
1,
'thisVal[Symbol.toPrimitive should have been accessed.'
);
assert.sameValue(
toStringAccessed,
1,
'thisVal[Symbol.toString should have been accessed.'
);
reportCompare(0, 0);

View File

@ -0,0 +1,59 @@
// Copyright (C) 2017 Valerie Young. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-string.prototype.trimEnd
description: >
Abrupt completion when valueOf called and returns an object
info: |
Runtime Semantics: TrimString ( string, where )
1. Let str be ? RequireObjectCoercible(string).
2. Let S be ? ToString(str).
...
ToString ( argument )
If argument is Object:
1. Let primValue be ? ToPrimitive(argument, hint String).
...
ToPrimitive ( input [, PreferredType ])
...
b. Else if PreferredType is hint String, let hint be "string".
...
d. Let exoticToPrim be ? GetMethod(input, @@toPrimitive)
e. If exoticToPrim is not undefined, then
i. Let result be ? Call(exoticToPrim, input, « hint »).
ii. If Type(result) is not Object, return result.
iii. Throw a TypeError exception.
f. If hint is "default", set hint to "number".
g. Return ? OrdinaryToPrimitive(input, hint).
...
OrdinaryToPrimitive( O, hint )
...
3. If hint is "string", then
a. Let methodNames be « "toString", "valueOf" ».
...
5. For each name in methodNames in List order, do
a. Let method be ? Get(O, name).
b. If IsCallable(method) is true, then
i. Let result be ? Call(method, O).
ii. If Type(result) is not Object, return result.
6. Throw a TypeError exception.
features: [string-trimming, String.prototype.trimEnd, Symbol.toPrimitive]
---*/
var thisVal = {
[Symbol.toPrimitive]: undefined,
toString: undefined,
valueOf: function() {
return {};
},
};
assert.throws(TypeError, function() {
String.prototype.trimEnd.call(thisVal);
});
reportCompare(0, 0);

View File

@ -0,0 +1,26 @@
// Copyright (C) 2017 Valerie Young. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-string.prototype.trimEnd
description: Type error when "this" value is a Symbol
info: |
Runtime Semantics: TrimString ( string, where )
2. Let S be ? ToString(str).
ToString ( argument )
Argument Type: Symbol
Result: Throw a TypeError exception
features: [string-trimming, String.prototype.trimEnd]
---*/
var trimEnd = String.prototype.trimEnd;
var symbol = Symbol();
assert.throws(
TypeError,
function() { trimEnd.call(symbol); },
'String.prototype.trimEnd.call(Symbol())'
);
reportCompare(0, 0);

View File

@ -0,0 +1,35 @@
// Copyright (c) 2017 Valerie Young. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-string.prototype.trimEnd
description: TrimEnd removes all whitespace from the end of a string.
info: |
Runtime Symantics: TrimString ( string, where )
...
3. Else if where is "end", let T be a String value that is a copy of S with
trailing white space removed.
...
The definition of white space is the union of WhiteSpace and LineTerminator.
When determining whether a Unicode code point is in Unicode general category
Zs, code unit sequences are interpreted as UTF-16 encoded code point
sequences as specified in 6.1.4.
features: [string-trimming, String.prototype.trimEnd]
---*/
var trimEnd = String.prototype.trimEnd;
// A string of all valid WhiteSpace Unicode code points
var wspc = '\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF';
var str = wspc + 'a' + wspc + 'b' + wspc;
var expected = wspc + 'a' + wspc + 'b';
assert.sameValue(
trimEnd.call(str),
expected,
);
reportCompare(0, 0);

View File

@ -0,0 +1,33 @@
// Copyright (C) 2017 Valerie Young. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-string.prototype.trimStart
description: >
String.prototype.trimStart.length is 0.
info: >
String.prototype.trimStart ( )
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]
features: [string-trimming, String.prototype.trimStart]
---*/
verifyProperty(String.prototype.trimStart, "length", {
value: 0,
enumerable: false,
writable: false,
configurable: true,
});
reportCompare(0, 0);

View File

@ -0,0 +1,30 @@
// Copyright (C) 2017 Valerie Young. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-string.prototype.trimStart
description: >
String.prototype.trimStart.name is "trimStart".
info: >
String.prototype.trimStart ( )
17 ECMAScript Standard Built-in Objects:
Every built-in Function object, including constructors, that is not
identified as an anonymous function has a name property whose value
is a String.
Unless otherwise specified, the name property of a built-in Function
object, if it exists, has the attributes { [[Writable]]: false,
[[Enumerable]]: false, [[Configurable]]: true }.
includes: [propertyHelper.js]
features: [string-trimming, String.prototype.trimStart]
---*/
verifyProperty(String.prototype.trimStart, "name", {
value: "trimStart",
enumerable: false,
writable: false,
configurable: true,
});
reportCompare(0, 0);

View File

@ -0,0 +1,24 @@
// Copyright (C) 2017 The Valerie Young. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-string.prototype.trimStart
description: >
"trimStart" property of String.prototype
info: >
17 ECMAScript Standard Built-in Objects:
Every other data property described in clauses 18 through 26 and in Annex B.2
has the attributes { [[Writable]]: true, [[Enumerable]]: false,
[[Configurable]]: true } unless otherwise specified.
includes: [propertyHelper.js]
features: [string-trimming, String.prototype.trimStart]
---*/
verifyProperty(String.prototype, "trimStart", {
enumerable: false,
writable: true,
configurable: true,
});
reportCompare(0, 0);

View File

@ -0,0 +1,33 @@
// Copyright (c) 2017 Valerie Young. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-string.prototype.trimStart
description: Behavior when "this" value is a boolean.
info: |
Runtime Semantics: TrimString ( string, where )
2. Let S be ? ToString(str).
ToString ( argument )
Argument Type: Boolean
Result:
If argument is true, return "true".
If argument is false, return "false".
features: [string-trimming, String.prototype.trimStart]
---*/
var trimStart = String.prototype.trimStart
assert.sameValue(
trimStart.call(true),
'true',
'String.prototype.trimStart.call(true)'
);
assert.sameValue(
String.prototype.trimStart.call(false),
'false',
'String.prototype.trimStart.call(false)'
);
reportCompare(0, 0);

View File

@ -0,0 +1,32 @@
// Copyright (c) 2017 Valerie Young. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-string.prototype.trimStart
description: TrimStart removes all line terminators from the start of a string.
info: |
Runtime Symantics: TrimString ( string, where )
...
4. If where is "start", let T be a String value that is a copy of S with
trailing white space removed.
...
The definition of white space is the union of WhiteSpace and LineTerminator.
features: [string-trimming, String.prototype.trimStart]
---*/
var trimStart = String.prototype.trimStart;
// A string of all valid LineTerminator Unicode code points
var lt = '\u000A\u000D\u2028\u2029';
var str = lt + 'a' + lt + 'b' + lt;
var expected = 'a' + lt + 'b' + lt;
assert.sameValue(
trimStart.call(str),
expected,
);
reportCompare(0, 0);

View File

@ -0,0 +1,24 @@
// Copyright (C) 2017 Valerie Young. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-string.prototype.trimStart
description: The "this" value must be object-coercible
info: |
1. Let O be ? RequireObjectCoercible(this value).
features: [string-trimming, String.prototype.trimStart]
---*/
var trimStart = String.prototype.trimStart;
assert.sameValue(typeof trimStart, 'function');
assert.throws(TypeError, function() {
trimStart.call(undefined);
}, 'undefined');
assert.throws(TypeError, function() {
trimStart.call(null);
}, 'null');
reportCompare(0, 0);

View File

@ -0,0 +1,50 @@
// Copyright (c) 2017 Valerie Young. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-string.prototype.trimStart
description: Behavoir when "this" value is a number.
info: |
Runtime Semantics: TrimString ( string, where )
2. Let S be ? ToString(str).
ToString ( argument )
Argument Type: Number
Result: NumberToString(argument)
features: [string-trimming, String.prototype.trimStart]
---*/
var trimStart = String.prototype.trimStart
assert.sameValue(
trimStart.call(NaN),
'NaN',
'String.prototype.trimStart.call(NaN)'
);
assert.sameValue(
trimStart.call(Infinity),
'Infinity',
'String.prototype.trimStart.call(Infinity)'
);
assert.sameValue(
trimStart.call(-0),
'0',
'String.prototype.trimStart.call(-0)'
);
assert.sameValue(
trimStart.call(1),
'1',
'String.prototype.trimStart.call(1)'
);
assert.sameValue(
trimStart.call(-1),
'-1',
'String.prototype.trimStart.call(-1)'
);
reportCompare(0, 0);

View File

@ -0,0 +1,59 @@
// Copyright (C) 2017 Valerie Young. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-string.prototype.trimStart
description: >
This value is an object which cannot be converted to a primitive
info: |
Runtime Semantics: TrimString ( string, where )
1. Let str be ? RequireObjectCoercible(string).
2. Let S be ? ToString(str).
...
ToString ( argument )
If argument is Object:
1. Let primValue be ? ToPrimitive(argument, hint String).
...
ToPrimitive ( input [, PreferredType ])
...
b. Else if PreferredType is hint String, let hint be "string".
...
d. Let exoticToPrim be ? GetMethod(input, @@toPrimitive)
e. If exoticToPrim is not undefined, then
i. Let result be ? Call(exoticToPrim, input, « hint »).
ii. If Type(result) is not Object, return result.
iii. Throw a TypeError exception.
f. If hint is "default", set hint to "number".
g. Return ? OrdinaryToPrimitive(input, hint).
...
OrdinaryToPrimitive( O, hint )
...
3. If hint is "string", then
a. Let methodNames be « "toString", "valueOf" ».
...
5. For each name in methodNames in List order, do
a. Let method be ? Get(O, name).
b. If IsCallable(method) is true, then
i. Let result be ? Call(method, O).
ii. If Type(result) is not Object, return result.
6. Throw a TypeError exception.
features: [string-trimming, String.prototype.trimStart, Symbol.toPrimitive]
---*/
var thisVal = {
[Symbol.toPrimitive]: undefined,
toString: undefined,
valueOf: undefined,
};
// If trimStart is called on an object with neither Symbol.toPrimitive, toString
// nor valueOf defined, then a TypeError exception should be thrown.
assert.throws(
TypeError,
function() { String.prototype.trimStart.call(thisVal); },
);
reportCompare(0, 0);

Some files were not shown because too many files have changed in this diff Show More