Backed out 3 changesets (bug 1892041) for causing failures on async-module-does-not...
[gecko.git] / js / src / tests / test262 / built-ins / String / prototype / at / index-argument-tointeger.js
blob1265d2412b248c700b2303ffb93f514fa6cc2fd3
1 // Copyright (C) 2020 Rick Waldron. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
3 /*---
4 esid: sec-string.prototype.at
5 description: >
6   Property type and descriptor.
7 info: |
8   String.prototype.at( index )
10   Let relativeIndex be ? ToInteger(index).
12 features: [String.prototype.at]
13 ---*/
14 assert.sameValue(typeof String.prototype.at, 'function');
16 let valueOfCallCount = 0;
17 let index = {
18   valueOf() {
19     valueOfCallCount++;
20     return 1;
21   }
24 let s = "01";
26 assert.sameValue(s.at(index), '1', 's.at({valueOf() {valueOfCallCount++; return 1;}}) must return 1');
27 assert.sameValue(valueOfCallCount, 1, 'The value of `valueOfCallCount` is 1');
29 reportCompare(0, 0);