|
| 1 | +'use strict'; |
| 2 | +const common = require('../common'); |
| 3 | + |
| 4 | +common.skipIfInspectorDisabled(); |
| 5 | + |
| 6 | +const fixtures = require('../common/fixtures'); |
| 7 | +const startCLI = require('../common/debugger'); |
| 8 | + |
| 9 | +const assert = require('assert'); |
| 10 | + |
| 11 | +const cli = startCLI([fixtures.path('debugger/empty.js')]); |
| 12 | + |
| 13 | +function onFatal(error) { |
| 14 | + cli.quit(); |
| 15 | + throw error; |
| 16 | +} |
| 17 | + |
| 18 | +cli.waitForInitialBreak() |
| 19 | + .then(() => cli.waitForPrompt()) |
| 20 | + .then(() => cli.command('exec new Date(0)')) |
| 21 | + .then(() => assert.match(cli.output, /1970-01-01T00:00:00\.000Z/)) |
| 22 | + .then(() => cli.command('exec null')) |
| 23 | + .then(() => assert.match(cli.output, /null/)) |
| 24 | + .then(() => cli.command('exec /regex/g')) |
| 25 | + .then(() => assert.match(cli.output, /\/regex\/g/)) |
| 26 | + .then(() => cli.command('exec new Map()')) |
| 27 | + .then(() => assert.match(cli.output, /{ size: 0 }/)) |
| 28 | + .then(() => cli.command('exec new Map([["a",1],["b",2]])')) |
| 29 | + .then(() => assert.match(cli.output, /{ size: 2 }/)) |
| 30 | + .then(() => cli.command('exec new Set()')) |
| 31 | + .then(() => assert.match(cli.output, /{ size: 0 }/)) |
| 32 | + .then(() => cli.command('exec new Set([1,2])')) |
| 33 | + .then(() => assert.match(cli.output, /{ size: 2 }/)) |
| 34 | + .then(() => cli.command('exec new Set([{a:1},new Set([1])])')) |
| 35 | + .then(() => assert.match(cli.output, /{ size: 2 }/)) |
| 36 | + .then(() => cli.command('exec a={}; a')) |
| 37 | + .then(() => assert.match(cli.output, /{ {2}}/)) |
| 38 | + .then(() => cli.command('exec a={a:1,b:{c:1}}; a')) |
| 39 | + .then(() => assert.match(cli.output, /{ a: 1, b: Object }/)) |
| 40 | + .then(() => cli.command('exec a=[]; a')) |
| 41 | + .then(() => assert.match(cli.output, /\[ {2}\]/)) |
| 42 | + .then(() => cli.command('exec a=[1,2]; a')) |
| 43 | + .then(() => assert.match(cli.output, /\[ 1, 2 \]/)) |
| 44 | + .then(() => cli.quit()) |
| 45 | + .then(null, onFatal); |
0 commit comments