From 3f4200397442afa7eb6096a99d68a4131c3cdd5f Mon Sep 17 00:00:00 2001 From: Valerie R Young Date: Mon, 25 Sep 2017 14:45:51 -0400 Subject: [PATCH] Add object coercible tests for trim(start/End) --- .../trimEnd/this-value-not-obj-coercible.js | 21 +++++++++++++++++++ .../trimStart/this-value-not-obj-coercible.js | 21 +++++++++++++++++++ 2 files changed, 42 insertions(+) create mode 100644 test/built-ins/String/prototype/trimEnd/this-value-not-obj-coercible.js create mode 100644 test/built-ins/String/prototype/trimStart/this-value-not-obj-coercible.js 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 0000000000..2800be2736 --- /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 0000000000..c7afae1e11 --- /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');