Skip to content

Commit

Permalink
fixup: Add boolean/Symbol() tests for trim(Start/End)
Browse files Browse the repository at this point in the history
  • Loading branch information
Valerie R Young committed Sep 29, 2017
1 parent c005c79 commit eea3252
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 27 deletions.
19 changes: 10 additions & 9 deletions test/built-ins/String/prototype/trimEnd/this-value-boolean.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,21 @@
// This code is governed by the BSD license found in the LICENSE file.

/*---
esid: pending
description: Behavoir when "this" value is a boolean.
esid: sec-string.prototype.trimEnd
description: Behavior when "this" value is a boolean.
features: [string-trimming]
---*/

var trimStart = String.prototype.trimStart
var trimEnd = String.prototype.trimEnd

assert.sameValue(
trimStart.call(true),
'true',
'String.prototype.trimStart.call(true)'
trimEnd.call(true),
'true',
'String.prototype.trimEnd.call(true)'
);

assert.sameValue(
String.prototype.trimStart.call(false),
'false',
'String.prototype.trimStart.call(false)'
String.prototype.trimEnd.call(false),
'false',
'String.prototype.trimEnd.call(false)'
);
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// This code is governed by the BSD license found in the LICENSE file.

/*---
esid: pending
esid: sec-string.prototype.trimEnd
description: Type error when "this" value is a Symbol
info: |
TrimString
Expand All @@ -11,11 +11,14 @@ info: |
ToString
Argument Type: Symbol
Result: Throw a TypeError exception
features: [string-trimming]
---*/

var trimEnd = String.prototype.trimEnd;
var symbol = Symbol()
var symbol = Symbol();

assert.throws(TypeError, function() {
trimEnd.call(symbol);
}, 'Symbol()');
assert.throws(
TypeError,
function() { trimEnd.call(symbol); },
'String.prototype.trimEnd.call(Symbol())'
);
17 changes: 9 additions & 8 deletions test/built-ins/String/prototype/trimStart/this-value-boolean.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,21 @@
// This code is governed by the BSD license found in the LICENSE file.

/*---
esid: pending
description: Behavoir when "this" value is a boolean.
esid: sec-string.prototype.trimStart
description: Behavior when "this" value is a boolean.
features: [string-trimming]
---*/

var trimStart = String.prototype.trimStart

assert.sameValue(
trimStart.call(true),
'true',
'String.prototype.trimStart.call(true)'
trimStart.call(true),
'true',
'String.prototype.trimStart.call(true)'
);

assert.sameValue(
String.prototype.trimStart.call(false),
'false',
'String.prototype.trimStart.call(false)'
String.prototype.trimStart.call(false),
'false',
'String.prototype.trimStart.call(false)'
);
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// This code is governed by the BSD license found in the LICENSE file.

/*---
esid: pending
esid: sec-string.prototype.trimStart
description: Type error when "this" value is a Symbol
info: |
TrimString
Expand All @@ -11,11 +11,14 @@ info: |
ToString
Argument Type: Symbol
Result: Throw a TypeError exception
features: [string-trimming]
---*/

var trimStart = String.prototype.trimStart;
var symbol = Symbol()
var symbol = Symbol();

assert.throws(TypeError, function() {
trimStart.call(symbol);
}, 'Symbol()');
assert.throws(
TypeError,
function() { trimStart.call(symbol); },
'String.prototype.trimStart.call(Symbol())'
);

0 comments on commit eea3252

Please sign in to comment.