blob: 4511de91ba6b039d30c07cface82855958beac1b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-string.prototype.substr
es6id: B.2.3.1
description: >
Behavior when "start" integer conversion triggers an abrupt completion
info: |
[...]
3. Let intStart be ? ToInteger(start).
features: [Symbol]
---*/
var lengthCallCount = 0;
var symbol = Symbol('');
var start = {
valueOf: function() {
throw new Test262Error();
}
};
var len = {
valueOf: function() {
lengthCallCount += 1;
}
};
assert.throws(Test262Error, function() {
''.substr(start, len);
});
assert.throws(TypeError, function() {
''.substr(symbol, len);
});
assert.sameValue(lengthCallCount, 0);
reportCompare(0, 0);
|