-
Notifications
You must be signed in to change notification settings - Fork 472
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add boolean/Symbol() tests for trim(Start/End)
- Loading branch information
Valerie R Young
committed
Sep 25, 2017
1 parent
ef1488e
commit 815cc6e
Showing
4 changed files
with
84 additions
and
0 deletions.
There are no files selected for viewing
21 changes: 21 additions & 0 deletions
21
test/built-ins/String/prototype/trimEnd/this-value-boolean.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)' | ||
); |
21 changes: 21 additions & 0 deletions
21
test/built-ins/String/prototype/trimEnd/this-value-symbol-typeerror.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
21
test/built-ins/String/prototype/trimStart/this-value-boolean.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)' | ||
); |
21 changes: 21 additions & 0 deletions
21
test/built-ins/String/prototype/trimStart/this-value-symbol-typeerror.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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()'); |