mirror of
https://github.com/tc39/test262.git
synced 2025-07-24 22:45:10 +02:00
Add object coercible tests for trim(start/End)
This commit is contained in:
parent
5931e313fc
commit
3f42003974
21
test/built-ins/String/prototype/trimEnd/this-value-not-obj-coercible.js
vendored
Normal file
21
test/built-ins/String/prototype/trimEnd/this-value-not-obj-coercible.js
vendored
Normal file
@ -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: The "this" value must be object-coercible
|
||||
info: |
|
||||
1. Let O be ? RequireObjectCoercible(this value).
|
||||
---*/
|
||||
|
||||
var trimEnd = String.prototype.trimEnd;
|
||||
|
||||
assert.sameValue(typeof trimEnd, 'function');
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
trimEnd.call(undefined);
|
||||
}, 'undefined');
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
trimEnd.call(null);
|
||||
}, 'null');
|
21
test/built-ins/String/prototype/trimStart/this-value-not-obj-coercible.js
vendored
Normal file
21
test/built-ins/String/prototype/trimStart/this-value-not-obj-coercible.js
vendored
Normal file
@ -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: The "this" value must be object-coercible
|
||||
info: |
|
||||
1. Let O be ? RequireObjectCoercible(this value).
|
||||
---*/
|
||||
|
||||
var trimStart = String.prototype.trimStart;
|
||||
|
||||
assert.sameValue(typeof trimStart, 'function');
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
trimStart.call(undefined);
|
||||
}, 'undefined');
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
trimStart.call(null);
|
||||
}, 'null');
|
Loading…
x
Reference in New Issue
Block a user