-
Notifications
You must be signed in to change notification settings - Fork 29.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
34 additions
and
29 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 |
---|---|---|
@@ -1,37 +1,42 @@ | ||
'use strict'; | ||
const common = require('../common'); | ||
const process = require('process'); | ||
|
||
process.env.TERM = 'dumb'; | ||
// TODO (fix): So this work on darwin/linux? | ||
if (process.env === 'windows') { | ||
process.env.TERM = 'dumb'; | ||
|
||
const repl = require('repl'); | ||
const ArrayStream = require('../common/arraystream'); | ||
const repl = require('repl'); | ||
const ArrayStream = require('../common/arraystream'); | ||
|
||
repl.start('> '); | ||
repl.start('> '); | ||
|
||
// Verify <ctrl> + D support. | ||
{ | ||
const stream = new ArrayStream(); | ||
const replServer = new repl.REPLServer({ | ||
prompt: '> ', | ||
terminal: true, | ||
input: stream, | ||
output: process.stdout, | ||
useColors: false | ||
}); | ||
// Verify <ctrl> + D support. | ||
{ | ||
const stream = new ArrayStream(); | ||
const replServer = new repl.REPLServer({ | ||
prompt: '> ', | ||
terminal: true, | ||
input: stream, | ||
output: process.stdout, | ||
useColors: false | ||
}); | ||
|
||
replServer.on('close', common.mustCall()); | ||
// Verify that <ctrl> + R or <ctrl> + C does not trigger the reverse search. | ||
replServer.write(null, { ctrl: true, name: 'r' }); | ||
replServer.write(null, { ctrl: true, name: 's' }); | ||
replServer.write(null, { ctrl: true, name: 'd' }); | ||
} | ||
replServer.on('close', common.mustCall()); | ||
// Verify that <ctrl> + R or <ctrl> + C does not trigger the reverse search. | ||
replServer.write(null, { ctrl: true, name: 'r' }); | ||
replServer.write(null, { ctrl: true, name: 's' }); | ||
replServer.write(null, { ctrl: true, name: 'd' }); | ||
} | ||
|
||
process.stdin.push('conso'); // No completion preview. | ||
process.stdin.push('le.log("foo")\n'); | ||
process.stdin.push('1 + 2'); // No input preview. | ||
process.stdin.push('\n'); | ||
process.stdin.push('"str"\n'); | ||
process.stdin.push('console.dir({ a: 1 })\n'); | ||
process.stdin.push('{ a: 1 }\n'); | ||
process.stdin.push('\n'); | ||
process.stdin.push('.exit\n'); | ||
|
||
process.stdin.push('conso'); // No completion preview. | ||
process.stdin.push('le.log("foo")\n'); | ||
process.stdin.push('1 + 2'); // No input preview. | ||
process.stdin.push('\n'); | ||
process.stdin.push('"str"\n'); | ||
process.stdin.push('console.dir({ a: 1 })\n'); | ||
process.stdin.push('{ a: 1 }\n'); | ||
process.stdin.push('\n'); | ||
process.stdin.push('.exit\n'); | ||
} |