michael@0: /* michael@0: * Any copyright is dedicated to the Public Domain. michael@0: * http://creativecommons.org/publicdomain/zero/1.0/ michael@0: */ michael@0: michael@0: // Test the webconsole output for various types of objects. michael@0: michael@0: const TEST_URI = "data:text/html;charset=utf8,test for console output - 05"; michael@0: michael@0: let dateNow = Date.now(); michael@0: michael@0: let inputTests = [ michael@0: // 0 michael@0: { michael@0: input: "/foo?b*\\s\"ar/igym", michael@0: output: "/foo?b*\\s\"ar/gimy", michael@0: printOutput: "/foo?b*\\s\"ar/gimy", michael@0: inspectable: true, michael@0: }, michael@0: michael@0: // 1 michael@0: { michael@0: input: "null", michael@0: output: "null", michael@0: }, michael@0: michael@0: // 2 michael@0: { michael@0: input: "undefined", michael@0: output: "undefined", michael@0: }, michael@0: michael@0: // 3 michael@0: { michael@0: input: "true", michael@0: output: "true", michael@0: }, michael@0: michael@0: // 4 michael@0: { michael@0: input: "new Boolean(false)", michael@0: output: "false", michael@0: inspectable: true, michael@0: }, michael@0: michael@0: // 5 michael@0: { michael@0: input: "new Date(" + dateNow + ")", michael@0: output: "Date " + (new Date(dateNow)).toISOString(), michael@0: printOutput: (new Date(dateNow)).toString(), michael@0: inspectable: true, michael@0: }, michael@0: michael@0: // 6 michael@0: { michael@0: input: "new Date('test')", michael@0: output: "Invalid Date", michael@0: printOutput: "Invalid Date", michael@0: inspectable: true, michael@0: variablesViewLabel: "Invalid Date", michael@0: }, michael@0: michael@0: // 7 michael@0: { michael@0: input: "new Number(43)", michael@0: output: "43", michael@0: inspectable: true, michael@0: }, michael@0: michael@0: // 8 michael@0: { michael@0: input: "new String('hello world')", michael@0: output: '"hello world"', michael@0: inspectable: true, michael@0: }, michael@0: ]; michael@0: michael@0: function test() { michael@0: Task.spawn(function*() { michael@0: let {tab} = yield loadTab(TEST_URI); michael@0: let hud = yield openConsole(tab); michael@0: return checkOutputForInputs(hud, inputTests); michael@0: }).then(finishUp); michael@0: } michael@0: michael@0: function finishUp() { michael@0: inputTests = null; michael@0: finishTest(); michael@0: }