| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 8339d9b commit fd37891
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,27 @@ | |||
| 1 | + 'use strict'; | ||
| 2 | + | ||
| 3 | + const common = require('../common'); | ||
| 4 | + const ArrayStream = require('../common/arraystream'); | ||
| 5 | + const assert = require('assert'); | ||
| 6 | + const repl = require('repl'); | ||
| 7 | + | ||
| 8 | + common.skipIfInspectorDisabled(); | ||
| 9 | + | ||
| 10 | + const inputStream = new ArrayStream(); | ||
| 11 | + const outputStream = new ArrayStream(); | ||
| 12 | + repl.start({ | ||
| 13 | + input: inputStream, | ||
| 14 | + output: outputStream, | ||
| 15 | + useGlobal: false, | ||
| 16 | + terminal: true, | ||
| 17 | + useColors: true | ||
| 18 | + }); | ||
| 19 | + | ||
| 20 | + let output = ''; | ||
| 21 | + outputStream.write = (chunk) => output += chunk; | ||
| 22 | + | ||
| 23 | + // Input without '\n' triggering actual run. | ||
| 24 | + const input = 'while (true) {}'; | ||
| 25 | + inputStream.emit('data', input); | ||
| 26 | + // No preview available when timed out. | ||
| 27 | + assert.strictEqual(output, input); | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments