Skip to content

Commit

Permalink
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 25, 2017
1 parent ef1488e commit 815cc6e
Show file tree
Hide file tree
Showing 4 changed files with 84 additions and 0 deletions.
21 changes: 21 additions & 0 deletions test/built-ins/String/prototype/trimEnd/this-value-boolean.js
Original file line number Diff line number Diff line change
@@ -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)'
);
Original file line number Diff line number Diff line change
@@ -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()');
21 changes: 21 additions & 0 deletions test/built-ins/String/prototype/trimStart/this-value-boolean.js
Original file line number Diff line number Diff line change
@@ -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)'
);
Original file line number Diff line number Diff line change
@@ -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()');

0 comments on commit 815cc6e

Please sign in to comment.