Skip to content

Commit 4587c81

Browse files
author
Valerie R Young
committed
fixup: Add boolean/Symbol() tests for trim(Start/End)
1 parent c005c79 commit 4587c81

File tree

4 files changed

+53
-27
lines changed

4 files changed

+53
-27
lines changed

test/built-ins/String/prototype/trimEnd/this-value-boolean.js

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,30 @@
22
// This code is governed by the BSD license found in the LICENSE file.
33

44
/*---
5-
esid: pending
6-
description: Behavoir when "this" value is a boolean.
5+
esid: sec-string.prototype.trimEnd
6+
description: Behavior when "this" value is a boolean.
7+
info: |
8+
TrimString
9+
2. Let S be ? ToString(str).
10+
11+
ToString
12+
Argument Type: Boolean
13+
Result:
14+
If argument is true, return "true".
15+
If argument is false, return "false".
16+
features: [string-trimming]
717
---*/
818

9-
var trimStart = String.prototype.trimStart
19+
var trimEnd = String.prototype.trimEnd
1020

1121
assert.sameValue(
12-
trimStart.call(true),
13-
'true',
14-
'String.prototype.trimStart.call(true)'
22+
trimEnd.call(true),
23+
'true',
24+
'String.prototype.trimEnd.call(true)'
1525
);
1626

1727
assert.sameValue(
18-
String.prototype.trimStart.call(false),
19-
'false',
20-
'String.prototype.trimStart.call(false)'
28+
String.prototype.trimEnd.call(false),
29+
'false',
30+
'String.prototype.trimEnd.call(false)'
2131
);

test/built-ins/String/prototype/trimEnd/this-value-symbol-typeerror.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// This code is governed by the BSD license found in the LICENSE file.
33

44
/*---
5-
esid: pending
5+
esid: sec-string.prototype.trimEnd
66
description: Type error when "this" value is a Symbol
77
info: |
88
TrimString
@@ -11,11 +11,14 @@ info: |
1111
ToString
1212
Argument Type: Symbol
1313
Result: Throw a TypeError exception
14+
features: [string-trimming]
1415
---*/
1516

1617
var trimEnd = String.prototype.trimEnd;
17-
var symbol = Symbol()
18+
var symbol = Symbol();
1819

19-
assert.throws(TypeError, function() {
20-
trimEnd.call(symbol);
21-
}, 'Symbol()');
20+
assert.throws(
21+
TypeError,
22+
function() { trimEnd.call(symbol); },
23+
'String.prototype.trimEnd.call(Symbol())'
24+
);

test/built-ins/String/prototype/trimStart/this-value-boolean.js

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,30 @@
22
// This code is governed by the BSD license found in the LICENSE file.
33

44
/*---
5-
esid: pending
6-
description: Behavoir when "this" value is a boolean.
5+
esid: sec-string.prototype.trimStart
6+
description: Behavior when "this" value is a boolean.
7+
info: |
8+
TrimString
9+
2. Let S be ? ToString(str).
10+
11+
ToString
12+
Argument Type: Boolean
13+
Result:
14+
If argument is true, return "true".
15+
If argument is false, return "false".
16+
features: [string-trimming]
717
---*/
818

919
var trimStart = String.prototype.trimStart
1020

1121
assert.sameValue(
12-
trimStart.call(true),
13-
'true',
14-
'String.prototype.trimStart.call(true)'
22+
trimStart.call(true),
23+
'true',
24+
'String.prototype.trimStart.call(true)'
1525
);
1626

1727
assert.sameValue(
18-
String.prototype.trimStart.call(false),
19-
'false',
20-
'String.prototype.trimStart.call(false)'
28+
String.prototype.trimStart.call(false),
29+
'false',
30+
'String.prototype.trimStart.call(false)'
2131
);

test/built-ins/String/prototype/trimStart/this-value-symbol-typeerror.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// This code is governed by the BSD license found in the LICENSE file.
33

44
/*---
5-
esid: pending
5+
esid: sec-string.prototype.trimStart
66
description: Type error when "this" value is a Symbol
77
info: |
88
TrimString
@@ -11,11 +11,14 @@ info: |
1111
ToString
1212
Argument Type: Symbol
1313
Result: Throw a TypeError exception
14+
features: [string-trimming]
1415
---*/
1516

1617
var trimStart = String.prototype.trimStart;
17-
var symbol = Symbol()
18+
var symbol = Symbol();
1819

19-
assert.throws(TypeError, function() {
20-
trimStart.call(symbol);
21-
}, 'Symbol()');
20+
assert.throws(
21+
TypeError,
22+
function() { trimStart.call(symbol); },
23+
'String.prototype.trimStart.call(Symbol())'
24+
);

0 commit comments

Comments
 (0)