Debian Codegraph @

js/src/tests/test262/annexB/built-ins/escape/to-primitive-observe.js

raw
1 // Copyright (C) 2020 Qu Xing. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
3 /*---
4 esid: sec-escape-string
5 description: Observable operations from string coercion
6 info: |
7 B.2.1.1 escape ( string )
8
9 1. Let string be ? ToString(string).
10 ...
11 features: [Symbol.toPrimitive]
12 ---*/
13
14 var obj = {
15 toString() { throw new Test262Error('this should be unreachable'); },
16 valueOf() { throw new Test262Error('this should be unreachable'); },
17 [Symbol.toPrimitive]() { return 'success'; }
18 };
19
20 assert.sameValue(escape(obj), 'success');
21
22 reportCompare(0, 0);