-
Notifications
You must be signed in to change notification settings - Fork 29.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: add tests for extracting function name
PR-URL: #42399 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
- Loading branch information
Showing
1 changed file
with
37 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
'use strict'; | ||
const common = require('../common'); | ||
|
||
common.skipIfInspectorDisabled(); | ||
|
||
const fixtures = require('../common/fixtures'); | ||
const startCLI = require('../common/debugger'); | ||
|
||
const assert = require('assert'); | ||
|
||
const cli = startCLI([fixtures.path('debugger', 'three-lines.js')]); | ||
|
||
function onFatal(error) { | ||
cli.quit(); | ||
throw error; | ||
} | ||
|
||
cli.waitForInitialBreak() | ||
.then(() => cli.waitForPrompt()) | ||
.then(() => cli.command('exec a = function func() {}; a;')) | ||
.then(() => assert.match(cli.output, /\[Function: func\]/)) | ||
.then(() => cli.command('exec a = function func () {}; a;')) | ||
.then(() => assert.match(cli.output, /\[Function\]/)) | ||
.then(() => cli.command('exec a = function() {}; a;')) | ||
.then(() => assert.match(cli.output, /\[Function: function\]/)) | ||
.then(() => cli.command('exec a = () => {}; a;')) | ||
.then(() => assert.match(cli.output, /\[Function\]/)) | ||
.then(() => cli.command('exec a = function* func() {}; a;')) | ||
.then(() => assert.match(cli.output, /\[GeneratorFunction: func\]/)) | ||
.then(() => cli.command('exec a = function *func() {}; a;')) | ||
.then(() => assert.match(cli.output, /\[GeneratorFunction: \*func\]/)) | ||
.then(() => cli.command('exec a = function*func() {}; a;')) | ||
.then(() => assert.match(cli.output, /\[GeneratorFunction: function\*func\]/)) | ||
.then(() => cli.command('exec a = function * func() {}; a;')) | ||
.then(() => assert.match(cli.output, /\[GeneratorFunction\]/)) | ||
.then(() => cli.quit()) | ||
.then(null, onFatal); |