aboutsummaryrefslogtreecommitdiff
path: root/test/sequential/test-debugger-repeat-last.js
diff options
context:
space:
mode:
authorkumarrishav <rishav006@gmail.com>2017-04-17 21:49:05 +0530
committerLuigi Pinca <luigipinca@gmail.com>2017-04-22 08:00:50 +0200
commit200961b7e1e42464417074700e5ca77a510be00c (patch)
treee07cec2c573a162b3e41fff05a54bb09fabc14a3 /test/sequential/test-debugger-repeat-last.js
parentbde26a62bfeb70b642b04bed401c03ba6f1de936 (diff)
downloadandroid-node-v8-200961b7e1e42464417074700e5ca77a510be00c.tar.gz
android-node-v8-200961b7e1e42464417074700e5ca77a510be00c.tar.bz2
android-node-v8-200961b7e1e42464417074700e5ca77a510be00c.zip
test: move test-debugger-repeat-last to sequential
PR-URL: https://github.com/nodejs/node/pull/12470 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Diffstat (limited to 'test/sequential/test-debugger-repeat-last.js')
-rw-r--r--test/sequential/test-debugger-repeat-last.js47
1 files changed, 47 insertions, 0 deletions
diff --git a/test/sequential/test-debugger-repeat-last.js b/test/sequential/test-debugger-repeat-last.js
new file mode 100644
index 0000000000..9d1dd4754d
--- /dev/null
+++ b/test/sequential/test-debugger-repeat-last.js
@@ -0,0 +1,47 @@
+'use strict';
+const common = require('../common');
+const path = require('path');
+const spawn = require('child_process').spawn;
+const assert = require('assert');
+const fixture = path.join(
+ common.fixturesDir,
+ 'debugger-repeat-last.js'
+);
+
+const args = [
+ 'debug',
+ `--port=${common.PORT}`,
+ fixture
+];
+
+const proc = spawn(process.execPath, args, { stdio: 'pipe' });
+proc.stdout.setEncoding('utf8');
+
+let stdout = '';
+
+let sentCommand = false;
+let sentExit = false;
+
+proc.stdout.on('data', (data) => {
+ stdout += data;
+
+ // Send 'n' as the first step.
+ if (!sentCommand && stdout.includes('> 1 ')) {
+ setImmediate(() => { proc.stdin.write('n\n'); });
+ return sentCommand = true;
+ }
+ // Send empty (repeat last command) until we reach line 5.
+ if (sentCommand && !stdout.includes('> 5')) {
+ setImmediate(() => { proc.stdin.write('\n'); });
+ return true;
+ }
+ if (!sentExit && stdout.includes('> 5')) {
+ setTimeout(() => { proc.stdin.write('\n\n\n.exit\n\n\n'); }, 1);
+ return sentExit = true;
+ }
+});
+
+process.on('exit', (exitCode) => {
+ assert.strictEqual(exitCode, 0);
+ console.log(stdout);
+});