summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/String/prototype/trimEnd
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/tests/test262/built-ins/String/prototype/trimEnd')
-rw-r--r--js/src/tests/test262/built-ins/String/prototype/trimEnd/browser.js0
-rw-r--r--js/src/tests/test262/built-ins/String/prototype/trimEnd/length.js33
-rw-r--r--js/src/tests/test262/built-ins/String/prototype/trimEnd/name.js30
-rw-r--r--js/src/tests/test262/built-ins/String/prototype/trimEnd/not-a-constructor.js35
-rw-r--r--js/src/tests/test262/built-ins/String/prototype/trimEnd/prop-desc.js24
-rw-r--r--js/src/tests/test262/built-ins/String/prototype/trimEnd/shell.js0
-rw-r--r--js/src/tests/test262/built-ins/String/prototype/trimEnd/this-value-boolean.js33
-rw-r--r--js/src/tests/test262/built-ins/String/prototype/trimEnd/this-value-line-terminator.js32
-rw-r--r--js/src/tests/test262/built-ins/String/prototype/trimEnd/this-value-not-obj-coercible.js24
-rw-r--r--js/src/tests/test262/built-ins/String/prototype/trimEnd/this-value-number.js49
-rw-r--r--js/src/tests/test262/built-ins/String/prototype/trimEnd/this-value-object-cannot-convert-to-primitive-err.js63
-rw-r--r--js/src/tests/test262/built-ins/String/prototype/trimEnd/this-value-object-toprimitive-call-err.js36
-rw-r--r--js/src/tests/test262/built-ins/String/prototype/trimEnd/this-value-object-toprimitive-meth-err.js38
-rw-r--r--js/src/tests/test262/built-ins/String/prototype/trimEnd/this-value-object-toprimitive-meth-priority.js82
-rw-r--r--js/src/tests/test262/built-ins/String/prototype/trimEnd/this-value-object-toprimitive-returns-object-err.js41
-rw-r--r--js/src/tests/test262/built-ins/String/prototype/trimEnd/this-value-object-tostring-call-err.js53
-rw-r--r--js/src/tests/test262/built-ins/String/prototype/trimEnd/this-value-object-tostring-meth-err.js55
-rw-r--r--js/src/tests/test262/built-ins/String/prototype/trimEnd/this-value-object-tostring-meth-priority.js99
-rw-r--r--js/src/tests/test262/built-ins/String/prototype/trimEnd/this-value-object-tostring-returns-object-err.js59
-rw-r--r--js/src/tests/test262/built-ins/String/prototype/trimEnd/this-value-object-valueof-call-err.js54
-rw-r--r--js/src/tests/test262/built-ins/String/prototype/trimEnd/this-value-object-valueof-meth-err.js56
-rw-r--r--js/src/tests/test262/built-ins/String/prototype/trimEnd/this-value-object-valueof-meth-priority.js95
-rw-r--r--js/src/tests/test262/built-ins/String/prototype/trimEnd/this-value-object-valueof-returns-object-err.js60
-rw-r--r--js/src/tests/test262/built-ins/String/prototype/trimEnd/this-value-symbol-typeerror.js30
-rw-r--r--js/src/tests/test262/built-ins/String/prototype/trimEnd/this-value-whitespace.js35
25 files changed, 1116 insertions, 0 deletions
diff --git a/js/src/tests/test262/built-ins/String/prototype/trimEnd/browser.js b/js/src/tests/test262/built-ins/String/prototype/trimEnd/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/String/prototype/trimEnd/browser.js
diff --git a/js/src/tests/test262/built-ins/String/prototype/trimEnd/length.js b/js/src/tests/test262/built-ins/String/prototype/trimEnd/length.js
new file mode 100644
index 0000000000..793721823e
--- /dev/null
+++ b/js/src/tests/test262/built-ins/String/prototype/trimEnd/length.js
@@ -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);
diff --git a/js/src/tests/test262/built-ins/String/prototype/trimEnd/name.js b/js/src/tests/test262/built-ins/String/prototype/trimEnd/name.js
new file mode 100644
index 0000000000..ad2c4d0d31
--- /dev/null
+++ b/js/src/tests/test262/built-ins/String/prototype/trimEnd/name.js
@@ -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);
diff --git a/js/src/tests/test262/built-ins/String/prototype/trimEnd/not-a-constructor.js b/js/src/tests/test262/built-ins/String/prototype/trimEnd/not-a-constructor.js
new file mode 100644
index 0000000000..0d8bea1970
--- /dev/null
+++ b/js/src/tests/test262/built-ins/String/prototype/trimEnd/not-a-constructor.js
@@ -0,0 +1,35 @@
+// Copyright (C) 2020 Rick Waldron. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-ecmascript-standard-built-in-objects
+description: >
+ String.prototype.trimEnd does not implement [[Construct]], is not new-able
+info: |
+ ECMAScript Function Objects
+
+ Built-in function objects that are not identified as constructors do not
+ implement the [[Construct]] internal method unless otherwise specified in
+ the description of a particular function.
+
+ sec-evaluatenew
+
+ ...
+ 7. If IsConstructor(constructor) is false, throw a TypeError exception.
+ ...
+includes: [isConstructor.js]
+features: [Reflect.construct, string-trimming, String.prototype.trimEnd, arrow-function]
+---*/
+
+assert.sameValue(
+ isConstructor(String.prototype.trimEnd),
+ false,
+ 'isConstructor(String.prototype.trimEnd) must return false'
+);
+
+assert.throws(TypeError, () => {
+ new String.prototype.trimEnd();
+}, '`new String.prototype.trimEnd()` throws TypeError');
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/String/prototype/trimEnd/prop-desc.js b/js/src/tests/test262/built-ins/String/prototype/trimEnd/prop-desc.js
new file mode 100644
index 0000000000..e0c43bc095
--- /dev/null
+++ b/js/src/tests/test262/built-ins/String/prototype/trimEnd/prop-desc.js
@@ -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);
diff --git a/js/src/tests/test262/built-ins/String/prototype/trimEnd/shell.js b/js/src/tests/test262/built-ins/String/prototype/trimEnd/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/String/prototype/trimEnd/shell.js
diff --git a/js/src/tests/test262/built-ins/String/prototype/trimEnd/this-value-boolean.js b/js/src/tests/test262/built-ins/String/prototype/trimEnd/this-value-boolean.js
new file mode 100644
index 0000000000..e4d99dc291
--- /dev/null
+++ b/js/src/tests/test262/built-ins/String/prototype/trimEnd/this-value-boolean.js
@@ -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);
diff --git a/js/src/tests/test262/built-ins/String/prototype/trimEnd/this-value-line-terminator.js b/js/src/tests/test262/built-ins/String/prototype/trimEnd/this-value-line-terminator.js
new file mode 100644
index 0000000000..1e78fd4d51
--- /dev/null
+++ b/js/src/tests/test262/built-ins/String/prototype/trimEnd/this-value-line-terminator.js
@@ -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);
diff --git a/js/src/tests/test262/built-ins/String/prototype/trimEnd/this-value-not-obj-coercible.js b/js/src/tests/test262/built-ins/String/prototype/trimEnd/this-value-not-obj-coercible.js
new file mode 100644
index 0000000000..5ceea74ebf
--- /dev/null
+++ b/js/src/tests/test262/built-ins/String/prototype/trimEnd/this-value-not-obj-coercible.js
@@ -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);
diff --git a/js/src/tests/test262/built-ins/String/prototype/trimEnd/this-value-number.js b/js/src/tests/test262/built-ins/String/prototype/trimEnd/this-value-number.js
new file mode 100644
index 0000000000..8446048b56
--- /dev/null
+++ b/js/src/tests/test262/built-ins/String/prototype/trimEnd/this-value-number.js
@@ -0,0 +1,49 @@
+// 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);
diff --git a/js/src/tests/test262/built-ins/String/prototype/trimEnd/this-value-object-cannot-convert-to-primitive-err.js b/js/src/tests/test262/built-ins/String/prototype/trimEnd/this-value-object-cannot-convert-to-primitive-err.js
new file mode 100644
index 0000000000..eb3e3a9dca
--- /dev/null
+++ b/js/src/tests/test262/built-ins/String/prototype/trimEnd/this-value-object-cannot-convert-to-primitive-err.js
@@ -0,0 +1,63 @@
+// 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]
+---*/
+
+assert.sameValue(typeof String.prototype.trimEnd, "function");
+
+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);
diff --git a/js/src/tests/test262/built-ins/String/prototype/trimEnd/this-value-object-toprimitive-call-err.js b/js/src/tests/test262/built-ins/String/prototype/trimEnd/this-value-object-toprimitive-call-err.js
new file mode 100644
index 0000000000..a59c2cb84e
--- /dev/null
+++ b/js/src/tests/test262/built-ins/String/prototype/trimEnd/this-value-object-toprimitive-call-err.js
@@ -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);
diff --git a/js/src/tests/test262/built-ins/String/prototype/trimEnd/this-value-object-toprimitive-meth-err.js b/js/src/tests/test262/built-ins/String/prototype/trimEnd/this-value-object-toprimitive-meth-err.js
new file mode 100644
index 0000000000..7237a7f670
--- /dev/null
+++ b/js/src/tests/test262/built-ins/String/prototype/trimEnd/this-value-object-toprimitive-meth-err.js
@@ -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);
diff --git a/js/src/tests/test262/built-ins/String/prototype/trimEnd/this-value-object-toprimitive-meth-priority.js b/js/src/tests/test262/built-ins/String/prototype/trimEnd/this-value-object-toprimitive-meth-priority.js
new file mode 100644
index 0000000000..57f92112d1
--- /dev/null
+++ b/js/src/tests/test262/built-ins/String/prototype/trimEnd/this-value-object-toprimitive-meth-priority.js
@@ -0,0 +1,82 @@
+// 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);
diff --git a/js/src/tests/test262/built-ins/String/prototype/trimEnd/this-value-object-toprimitive-returns-object-err.js b/js/src/tests/test262/built-ins/String/prototype/trimEnd/this-value-object-toprimitive-returns-object-err.js
new file mode 100644
index 0000000000..7405357aec
--- /dev/null
+++ b/js/src/tests/test262/built-ins/String/prototype/trimEnd/this-value-object-toprimitive-returns-object-err.js
@@ -0,0 +1,41 @@
+// 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.sameValue(typeof String.prototype.trimEnd, 'function');
+assert.throws(TypeError, function() {
+ String.prototype.trimEnd.call(thisVal);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/String/prototype/trimEnd/this-value-object-tostring-call-err.js b/js/src/tests/test262/built-ins/String/prototype/trimEnd/this-value-object-tostring-call-err.js
new file mode 100644
index 0000000000..9cff1caedf
--- /dev/null
+++ b/js/src/tests/test262/built-ins/String/prototype/trimEnd/this-value-object-tostring-call-err.js
@@ -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);
diff --git a/js/src/tests/test262/built-ins/String/prototype/trimEnd/this-value-object-tostring-meth-err.js b/js/src/tests/test262/built-ins/String/prototype/trimEnd/this-value-object-tostring-meth-err.js
new file mode 100644
index 0000000000..3f19b7b84b
--- /dev/null
+++ b/js/src/tests/test262/built-ins/String/prototype/trimEnd/this-value-object-tostring-meth-err.js
@@ -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);
diff --git a/js/src/tests/test262/built-ins/String/prototype/trimEnd/this-value-object-tostring-meth-priority.js b/js/src/tests/test262/built-ins/String/prototype/trimEnd/this-value-object-tostring-meth-priority.js
new file mode 100644
index 0000000000..0a46f14354
--- /dev/null
+++ b/js/src/tests/test262/built-ins/String/prototype/trimEnd/this-value-object-tostring-meth-priority.js
@@ -0,0 +1,99 @@
+// 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);
diff --git a/js/src/tests/test262/built-ins/String/prototype/trimEnd/this-value-object-tostring-returns-object-err.js b/js/src/tests/test262/built-ins/String/prototype/trimEnd/this-value-object-tostring-returns-object-err.js
new file mode 100644
index 0000000000..1acf34e68d
--- /dev/null
+++ b/js/src/tests/test262/built-ins/String/prototype/trimEnd/this-value-object-tostring-returns-object-err.js
@@ -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 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.sameValue(typeof String.prototype.trimEnd, 'function');
+assert.throws(TypeError, function() {
+ String.prototype.trimEnd.call(thisVal);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/String/prototype/trimEnd/this-value-object-valueof-call-err.js b/js/src/tests/test262/built-ins/String/prototype/trimEnd/this-value-object-valueof-call-err.js
new file mode 100644
index 0000000000..e9942b432b
--- /dev/null
+++ b/js/src/tests/test262/built-ins/String/prototype/trimEnd/this-value-object-valueof-call-err.js
@@ -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);
diff --git a/js/src/tests/test262/built-ins/String/prototype/trimEnd/this-value-object-valueof-meth-err.js b/js/src/tests/test262/built-ins/String/prototype/trimEnd/this-value-object-valueof-meth-err.js
new file mode 100644
index 0000000000..f143313869
--- /dev/null
+++ b/js/src/tests/test262/built-ins/String/prototype/trimEnd/this-value-object-valueof-meth-err.js
@@ -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);
diff --git a/js/src/tests/test262/built-ins/String/prototype/trimEnd/this-value-object-valueof-meth-priority.js b/js/src/tests/test262/built-ins/String/prototype/trimEnd/this-value-object-valueof-meth-priority.js
new file mode 100644
index 0000000000..45f4bc73c4
--- /dev/null
+++ b/js/src/tests/test262/built-ins/String/prototype/trimEnd/this-value-object-valueof-meth-priority.js
@@ -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 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);
diff --git a/js/src/tests/test262/built-ins/String/prototype/trimEnd/this-value-object-valueof-returns-object-err.js b/js/src/tests/test262/built-ins/String/prototype/trimEnd/this-value-object-valueof-returns-object-err.js
new file mode 100644
index 0000000000..00e4041850
--- /dev/null
+++ b/js/src/tests/test262/built-ins/String/prototype/trimEnd/this-value-object-valueof-returns-object-err.js
@@ -0,0 +1,60 @@
+// 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.sameValue(typeof String.prototype.trimEnd, 'function');
+assert.throws(TypeError, function() {
+ String.prototype.trimEnd.call(thisVal);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/String/prototype/trimEnd/this-value-symbol-typeerror.js b/js/src/tests/test262/built-ins/String/prototype/trimEnd/this-value-symbol-typeerror.js
new file mode 100644
index 0000000000..5150212023
--- /dev/null
+++ b/js/src/tests/test262/built-ins/String/prototype/trimEnd/this-value-symbol-typeerror.js
@@ -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: 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]
+---*/
+
+assert.sameValue(typeof String.prototype.trimEnd, "function");
+
+var trimEnd = String.prototype.trimEnd;
+var symbol = Symbol();
+
+assert.throws(
+ TypeError,
+ function() {
+ trimEnd.call(symbol);
+ },
+ 'String.prototype.trimEnd.call(Symbol())'
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/String/prototype/trimEnd/this-value-whitespace.js b/js/src/tests/test262/built-ins/String/prototype/trimEnd/this-value-whitespace.js
new file mode 100644
index 0000000000..27e8a832c2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/String/prototype/trimEnd/this-value-whitespace.js
@@ -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);