assert-samevalue-tostring.js (666B)
1 // Copyright (C) 2019 Alexey Shvayka. All rights reserved. 2 // This code is governed by the BSD license found in the LICENSE file. 3 4 /*--- 5 description: > 6 When composing a message, errors from ToString are handled. 7 features: [async-functions] 8 ---*/ 9 10 var threw = false; 11 var asyncFunProto = Object.getPrototypeOf(async function() {}); 12 13 try { 14 assert.sameValue(asyncFunProto, 1); 15 } catch (err) { 16 threw = true; 17 if (err.constructor !== Test262Error) { 18 throw new Error('Expected a Test262Error, but a "' + err.constructor.name + '" was thrown.'); 19 } 20 } 21 22 if (!threw) { 23 throw new Error('Expected a Test262Error, but no error was thrown.'); 24 } 25 26 reportCompare(0, 0);