From 0c796ea88bb7359cdb662005fd3e07538023d0bb Mon Sep 17 00:00:00 2001 From: Valerie R Young Date: Mon, 25 Sep 2017 17:53:43 -0400 Subject: [PATCH] Add boolean/Symbol() tests for trim(Start/End) --- .../prototype/trimEnd/this-value-boolean.js | 21 +++++++++++++++++++ .../trimEnd/this-value-symbol-typeerror.js | 21 +++++++++++++++++++ .../prototype/trimStart/this-value-boolean.js | 21 +++++++++++++++++++ .../trimStart/this-value-symbol-typeerror.js | 21 +++++++++++++++++++ 4 files changed, 84 insertions(+) create mode 100644 test/built-ins/String/prototype/trimEnd/this-value-boolean.js create mode 100644 test/built-ins/String/prototype/trimEnd/this-value-symbol-typeerror.js create mode 100644 test/built-ins/String/prototype/trimStart/this-value-boolean.js create mode 100644 test/built-ins/String/prototype/trimStart/this-value-symbol-typeerror.js diff --git a/test/built-ins/String/prototype/trimEnd/this-value-boolean.js b/test/built-ins/String/prototype/trimEnd/this-value-boolean.js new file mode 100644 index 0000000000..1a695e3b97 --- /dev/null +++ b/test/built-ins/String/prototype/trimEnd/this-value-boolean.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: Behavoir when "this" value is a boolean. +---*/ + +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)' +); diff --git a/test/built-ins/String/prototype/trimEnd/this-value-symbol-typeerror.js b/test/built-ins/String/prototype/trimEnd/this-value-symbol-typeerror.js new file mode 100644 index 0000000000..e9f32fb76b --- /dev/null +++ b/test/built-ins/String/prototype/trimEnd/this-value-symbol-typeerror.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: Type error when "this" value is a Symbol +info: | + TrimString + 2. Let S be ? ToString(str). + + ToString + Argument Type: Symbol + Result: Throw a TypeError exception +---*/ + +var trimEnd = String.prototype.trimEnd; +var symbol = Symbol() + +assert.throws(TypeError, function() { + trimEnd.call(symbol); +}, 'Symbol()'); diff --git a/test/built-ins/String/prototype/trimStart/this-value-boolean.js b/test/built-ins/String/prototype/trimStart/this-value-boolean.js new file mode 100644 index 0000000000..1a695e3b97 --- /dev/null +++ b/test/built-ins/String/prototype/trimStart/this-value-boolean.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: Behavoir when "this" value is a boolean. +---*/ + +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)' +); diff --git a/test/built-ins/String/prototype/trimStart/this-value-symbol-typeerror.js b/test/built-ins/String/prototype/trimStart/this-value-symbol-typeerror.js new file mode 100644 index 0000000000..b3b87c63f8 --- /dev/null +++ b/test/built-ins/String/prototype/trimStart/this-value-symbol-typeerror.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: Type error when "this" value is a Symbol +info: | + TrimString + 2. Let S be ? ToString(str). + + ToString + Argument Type: Symbol + Result: Throw a TypeError exception +---*/ + +var trimStart = String.prototype.trimStart; +var symbol = Symbol() + +assert.throws(TypeError, function() { + trimStart.call(symbol); +}, 'Symbol()');