11cb0ef41Sopenharmony_ci"use strict"; 21cb0ef41Sopenharmony_ci// https://console.spec.whatwg/org/#counting 31cb0ef41Sopenharmony_ci// https://console.spec.whatwg/org/#timing 41cb0ef41Sopenharmony_ci 51cb0ef41Sopenharmony_ciconst methods = ['count', 'countReset', 'time', 'timeLog', 'timeEnd']; 61cb0ef41Sopenharmony_ci 71cb0ef41Sopenharmony_cifor (const method of methods) { 81cb0ef41Sopenharmony_ci test(() => { 91cb0ef41Sopenharmony_ci let labelToStringCalled = false; 101cb0ef41Sopenharmony_ci 111cb0ef41Sopenharmony_ci console[method]({ 121cb0ef41Sopenharmony_ci toString() { 131cb0ef41Sopenharmony_ci labelToStringCalled = true; 141cb0ef41Sopenharmony_ci } 151cb0ef41Sopenharmony_ci }); 161cb0ef41Sopenharmony_ci 171cb0ef41Sopenharmony_ci assert_true(labelToStringCalled, `${method}() must call toString() on label when label is an object`); 181cb0ef41Sopenharmony_ci }, `console.${method}()'s label gets converted to string via label.toString() when label is an object`); 191cb0ef41Sopenharmony_ci 201cb0ef41Sopenharmony_ci test(() => { 211cb0ef41Sopenharmony_ci assert_throws_js(Error, () => { 221cb0ef41Sopenharmony_ci console[method]({ 231cb0ef41Sopenharmony_ci toString() { 241cb0ef41Sopenharmony_ci throw new Error('conversion error'); 251cb0ef41Sopenharmony_ci } 261cb0ef41Sopenharmony_ci }); 271cb0ef41Sopenharmony_ci }, `${method} must re-throw any exceptions thrown by label.toString() conversion`); 281cb0ef41Sopenharmony_ci }, `console.${method}() throws exceptions generated by erroneous label.toString() conversion`); 291cb0ef41Sopenharmony_ci} 30