GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — test: refactor test-repl-definecommand · nodejs/node@f291bc1

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • test/parallel
    • test-repl-definecommand.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎test/parallel/test-repl-definecommand.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-repl-definecommand.js
+10-4Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,21 +23,27 @@ r.defineCommand('say1', {
2323
help: 'help for say1',
2424
action: function(thing) {
2525
output = '';
26-
this.write(`hello ${thing}`);
26+
this.output.write(`hello ${thing}\n`);
2727
this.displayPrompt();
2828
}
2929
});
3030

3131
r.defineCommand('say2', function() {
3232
output = '';
33-
this.write('hello from say2');
33+
this.output.write('hello from say2\n');
3434
this.displayPrompt();
3535
});
3636

3737
inputStream.write('.help\n');
3838
assert(/\n.say1 help for say1\n/.test(output), 'help for say1 not present');
3939
assert(/\n.say2\n/.test(output), 'help for say2 not present');
4040
inputStream.write('.say1 node developer\n');
41-
assert(/> hello node developer/.test(output), 'say1 outputted incorrectly');
41+
assert.ok(output.startsWith('hello node developer\n'),
42+
`say1 output starts incorrectly: "${output}"`);
43+
assert.ok(output.includes('> '),
44+
`say1 output does not include prompt: "${output}"`);
4245
inputStream.write('.say2 node developer\n');
43-
assert(/> hello from say2/.test(output), 'say2 outputted incorrectly');
46+
assert.ok(output.startsWith('hello from say2\n'),
47+
`say2 output starts incorrectly: "${output}"`);
48+
assert.ok(output.includes('> '),
49+
`say2 output does not include prompt: "${output}"`);

0 commit comments

Comments
0 (0)
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.