|
1 /* |
|
2 * Any copyright is dedicated to the Public Domain. |
|
3 * http://creativecommons.org/publicdomain/zero/1.0/ |
|
4 */ |
|
5 |
|
6 // Test the webconsole output for various types of objects. |
|
7 |
|
8 const TEST_URI = "data:text/html;charset=utf8,test for console output - 05"; |
|
9 |
|
10 let dateNow = Date.now(); |
|
11 |
|
12 let inputTests = [ |
|
13 // 0 |
|
14 { |
|
15 input: "/foo?b*\\s\"ar/igym", |
|
16 output: "/foo?b*\\s\"ar/gimy", |
|
17 printOutput: "/foo?b*\\s\"ar/gimy", |
|
18 inspectable: true, |
|
19 }, |
|
20 |
|
21 // 1 |
|
22 { |
|
23 input: "null", |
|
24 output: "null", |
|
25 }, |
|
26 |
|
27 // 2 |
|
28 { |
|
29 input: "undefined", |
|
30 output: "undefined", |
|
31 }, |
|
32 |
|
33 // 3 |
|
34 { |
|
35 input: "true", |
|
36 output: "true", |
|
37 }, |
|
38 |
|
39 // 4 |
|
40 { |
|
41 input: "new Boolean(false)", |
|
42 output: "false", |
|
43 inspectable: true, |
|
44 }, |
|
45 |
|
46 // 5 |
|
47 { |
|
48 input: "new Date(" + dateNow + ")", |
|
49 output: "Date " + (new Date(dateNow)).toISOString(), |
|
50 printOutput: (new Date(dateNow)).toString(), |
|
51 inspectable: true, |
|
52 }, |
|
53 |
|
54 // 6 |
|
55 { |
|
56 input: "new Date('test')", |
|
57 output: "Invalid Date", |
|
58 printOutput: "Invalid Date", |
|
59 inspectable: true, |
|
60 variablesViewLabel: "Invalid Date", |
|
61 }, |
|
62 |
|
63 // 7 |
|
64 { |
|
65 input: "new Number(43)", |
|
66 output: "43", |
|
67 inspectable: true, |
|
68 }, |
|
69 |
|
70 // 8 |
|
71 { |
|
72 input: "new String('hello world')", |
|
73 output: '"hello world"', |
|
74 inspectable: true, |
|
75 }, |
|
76 ]; |
|
77 |
|
78 function test() { |
|
79 Task.spawn(function*() { |
|
80 let {tab} = yield loadTab(TEST_URI); |
|
81 let hud = yield openConsole(tab); |
|
82 return checkOutputForInputs(hud, inputTests); |
|
83 }).then(finishUp); |
|
84 } |
|
85 |
|
86 function finishUp() { |
|
87 inputTests = null; |
|
88 finishTest(); |
|
89 } |