зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1610754 - Display falsy values in eager evaluation result. r=jlast.
We weren't displaying results when they were falsy (0, false, empty string, ...). This is fixed by this patch that adds a few test cases to ensure we don't regress. Differential Revision: https://phabricator.services.mozilla.com/D60692 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
c4d61e7193
Коммит
aad6b11a7d
|
@ -265,8 +265,11 @@ function terminalInputChanged(expression) {
|
|||
|
||||
function getEagerEvaluationResult(response) {
|
||||
const result = response.exception || response.result;
|
||||
// Don't show syntax errors or undefined results to the user.
|
||||
if (!result || result.isSyntaxError || result.type == "undefined") {
|
||||
// Don't show syntax errors results to the user.
|
||||
if (
|
||||
(result && result.isSyntaxError) ||
|
||||
(result && result.type == "undefined")
|
||||
) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
@ -39,6 +39,18 @@ add_task(async function() {
|
|||
setInputValue(hud, "x + y + undefined");
|
||||
await waitForEagerEvaluationResult(hud, "NaN");
|
||||
|
||||
setInputValue(hud, "1 - 1");
|
||||
await waitForEagerEvaluationResult(hud, "0");
|
||||
|
||||
setInputValue(hud, "!true");
|
||||
await waitForEagerEvaluationResult(hud, "false");
|
||||
|
||||
setInputValue(hud, `"ab".slice(0, 0)`);
|
||||
await waitForEagerEvaluationResult(hud, `""`);
|
||||
|
||||
setInputValue(hud, `JSON.parse("null")`);
|
||||
await waitForEagerEvaluationResult(hud, "null");
|
||||
|
||||
setInputValue(hud, "-x / 0");
|
||||
await waitForEagerEvaluationResult(hud, "-Infinity");
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче