v8/test/inspector/runtime/console-time-end-format.js
Varun Varada a25dce8a05 Fix console time format error
There should be a space between the quantity and the unit symbol
as per the SI, so this commit fixes this issue.

Change-Id: I3356942391d96906f3e3840c7bb802e10f29eb4a
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2190230
Commit-Queue: Yang Guo <yangguo@chromium.org>
Reviewed-by: Yang Guo <yangguo@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67789}
2020-05-14 07:36:54 +00:00

52 lines
1.4 KiB
JavaScript

// Copyright 2017 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
let {session, contextGroup, Protocol} = InspectorTest.start('Checks format of console.timeEnd output');
Protocol.Runtime.enable();
Protocol.Runtime.onConsoleAPICalled(message => {
InspectorTest.log(message.params.args[0].value);
});
InspectorTest.runAsyncTestSuite([
function zero() {
return checkInterval(0.0);
},
function verySmall() {
return checkInterval(1e-15);
},
function small() {
return checkInterval(0.001);
},
function regular() {
return checkInterval(1.2345);
},
function big() {
return checkInterval(10000.2345);
},
function veryBig() {
return checkInterval(1e+15 + 0.2345);
},
function huge() {
return checkInterval(1e+42);
},
function undefinedAsLabel() {
return checkInterval(1.0, 'undefined');
},
function emptyAsLabel() {
return checkInterval(1.0, '');
}
]);
async function checkInterval(time, label) {
label = label === undefined ? '\'timeEnd\'' : label;
utils.setCurrentTimeMSForTest(0.0);
Protocol.Runtime.evaluate({
expression: `console.log('js: ' + ${time} + ' ms')`
});
await Protocol.Runtime.evaluate({expression: `console.time(${label})`});
utils.setCurrentTimeMSForTest(time);
await Protocol.Runtime.evaluate({expression: `console.timeEnd(${label})`});
}