diff --git a/test/built-ins/String/prototype/trimEnd/this-value-not-obj-coercible.js b/test/built-ins/String/prototype/trimEnd/this-value-not-obj-coercible.js new file mode 100644 index 0000000000000000000000000000000000000000..2800be27362148a3fcdc5373bb823b1d75412c97 --- /dev/null +++ b/test/built-ins/String/prototype/trimEnd/this-value-not-obj-coercible.js @@ -0,0 +1,21 @@ +// Copyright (C) 2017 Valerie Young. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: pending +description: The "this" value must be object-coercible +info: | + 1. Let O be ? RequireObjectCoercible(this value). +---*/ + +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'); diff --git a/test/built-ins/String/prototype/trimStart/this-value-not-obj-coercible.js b/test/built-ins/String/prototype/trimStart/this-value-not-obj-coercible.js new file mode 100644 index 0000000000000000000000000000000000000000..c7afae1e1130063db233c8677aa9a4ec39da0531 --- /dev/null +++ b/test/built-ins/String/prototype/trimStart/this-value-not-obj-coercible.js @@ -0,0 +1,21 @@ +// Copyright (C) 2017 Valerie Young. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: pending +description: The "this" value must be object-coercible +info: | + 1. Let O be ? RequireObjectCoercible(this value). +---*/ + +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');