From c13978c718f83dee944e554364a4845c5a4c54c6 Mon Sep 17 00:00:00 2001 From: Valerie R Young Date: Fri, 29 Sep 2017 16:26:12 -0400 Subject: [PATCH] Add number tests for trim(Start/End) --- .../prototype/trimEnd/this-value-number.js | 48 +++++++++++++++++++ .../prototype/trimStart/this-value-number.js | 48 +++++++++++++++++++ 2 files changed, 96 insertions(+) create mode 100644 test/built-ins/String/prototype/trimEnd/this-value-number.js create mode 100644 test/built-ins/String/prototype/trimStart/this-value-number.js diff --git a/test/built-ins/String/prototype/trimEnd/this-value-number.js b/test/built-ins/String/prototype/trimEnd/this-value-number.js new file mode 100644 index 00000000000..3b7d1773376 --- /dev/null +++ b/test/built-ins/String/prototype/trimEnd/this-value-number.js @@ -0,0 +1,48 @@ +// 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: | + TrimString + 2. Let S be ? ToString(str). + + ToString + Argument Type: Number + Result: NumberToString(argument) +features: [string-trimming] +---*/ + +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)' +); + diff --git a/test/built-ins/String/prototype/trimStart/this-value-number.js b/test/built-ins/String/prototype/trimStart/this-value-number.js new file mode 100644 index 00000000000..0a0420f389c --- /dev/null +++ b/test/built-ins/String/prototype/trimStart/this-value-number.js @@ -0,0 +1,48 @@ +// 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: | + TrimString + 2. Let S be ? ToString(str). + + ToString + Argument Type: Number + Result: NumberToString(argument) +features: [string-trimming] +---*/ + +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)' +); +