-
Notifications
You must be signed in to change notification settings - Fork 100
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
src: don't crash with no arguments to print (#106)
* src: replace uses of NULL with nullptr * src: don't segfault on null commands This commit prevents the DoExecute() methods from segfaulting when the cmd argument is null. * test: allow stderr to be scripted This commit allows stderr to be scripted in the same way that stdout is. * test: validate command usage messages PR-URL: #106 Reviewed-By: Ben Noordhuis <[email protected]>
- Loading branch information
Showing
4 changed files
with
117 additions
and
53 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
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
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
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,44 @@ | ||
'use strict'; | ||
const tape = require('tape'); | ||
const common = require('./common'); | ||
|
||
function removeBlankLines(lines) { | ||
return lines.filter((line) => { return line.trim() !== ''; }); | ||
} | ||
|
||
tape('usage messages', (t) => { | ||
t.timeoutAfter(15000); | ||
|
||
const sess = common.Session.create('inspect-scenario.js'); | ||
|
||
sess.waitBreak(() => { | ||
sess.send('v8 print'); | ||
}); | ||
|
||
sess.stderr.linesUntil(/USAGE/, (lines) => { | ||
t.ok(/^error: USAGE: v8 print expr$/.test(removeBlankLines(lines)[0]), | ||
'print usage message'); | ||
sess.send('v8 source list'); | ||
}); | ||
|
||
sess.stderr.linesUntil(/USAGE/, (lines) => { | ||
t.ok(/^error: USAGE: v8 source list$/.test(removeBlankLines(lines)[0]), | ||
'list usage message'); | ||
sess.send('v8 findjsinstances'); | ||
}); | ||
|
||
sess.stderr.linesUntil(/USAGE/, (lines) => { | ||
const re = /^error: USAGE: v8 findjsinstances \[-Fm\] instance_name$/; | ||
|
||
t.ok(re.test(removeBlankLines(lines)[0]), | ||
'findjsinstances usage message'); | ||
sess.send('v8 findrefs'); | ||
}); | ||
|
||
sess.stderr.linesUntil(/USAGE/, (lines) => { | ||
t.ok(/^error: USAGE: v8 findrefs expr$/.test(removeBlankLines(lines)[0]), | ||
'findrefs usage message'); | ||
sess.quit(); | ||
t.end(); | ||
}); | ||
}); |