2015-05-19 19:00:06 +08:00
|
|
|
'use strict';
|
2017-01-04 03:24:27 +08:00
|
|
|
const common = require('../common');
|
2016-12-31 07:38:06 +08:00
|
|
|
const repl = require('./helper-debugger-repl.js');
|
2011-09-23 01:03:46 +08:00
|
|
|
|
2013-04-27 03:07:56 +08:00
|
|
|
repl.startDebugger('breakpoints.js');
|
2012-03-21 10:48:07 +08:00
|
|
|
|
2017-01-08 21:19:00 +08:00
|
|
|
const addTest = repl.addTest;
|
2011-09-23 01:03:46 +08:00
|
|
|
|
|
|
|
// Next
|
|
|
|
addTest('n', [
|
2011-11-05 00:20:53 +08:00
|
|
|
/break in .*:11/,
|
|
|
|
/9/, /10/, /11/, /12/, /13/
|
2011-09-23 01:03:46 +08:00
|
|
|
]);
|
|
|
|
|
2011-09-30 02:18:35 +08:00
|
|
|
// Watch
|
2013-02-27 08:42:47 +08:00
|
|
|
addTest('watch("\'x\'")');
|
2011-09-30 02:18:35 +08:00
|
|
|
|
2011-09-23 01:03:46 +08:00
|
|
|
// Continue
|
|
|
|
addTest('c', [
|
2011-11-05 00:20:53 +08:00
|
|
|
/break in .*:5/,
|
2011-09-30 02:18:35 +08:00
|
|
|
/Watchers/,
|
|
|
|
/0:\s+'x' = "x"/,
|
|
|
|
/()/,
|
2011-11-05 00:20:53 +08:00
|
|
|
/3/, /4/, /5/, /6/, /7/
|
2011-09-23 01:03:46 +08:00
|
|
|
]);
|
|
|
|
|
2011-09-30 02:18:35 +08:00
|
|
|
// Show watchers
|
|
|
|
addTest('watchers', [
|
|
|
|
/0:\s+'x' = "x"/
|
|
|
|
]);
|
|
|
|
|
|
|
|
// Unwatch
|
2013-02-27 08:42:47 +08:00
|
|
|
addTest('unwatch("\'x\'")');
|
2011-09-30 02:18:35 +08:00
|
|
|
|
2011-09-23 01:03:46 +08:00
|
|
|
// Step out
|
|
|
|
addTest('o', [
|
2011-11-05 00:20:53 +08:00
|
|
|
/break in .*:12/,
|
|
|
|
/10/, /11/, /12/, /13/, /14/
|
2011-09-23 01:03:46 +08:00
|
|
|
]);
|
|
|
|
|
2011-09-26 03:20:47 +08:00
|
|
|
// Continue
|
|
|
|
addTest('c', [
|
2011-11-05 00:20:53 +08:00
|
|
|
/break in .*:5/,
|
|
|
|
/3/, /4/, /5/, /6/, /7/
|
2011-09-26 03:20:47 +08:00
|
|
|
]);
|
|
|
|
|
2011-09-27 14:25:31 +08:00
|
|
|
// Set breakpoint by function name
|
|
|
|
addTest('sb("setInterval()", "!(setInterval.flag++)")', [
|
2011-11-05 00:20:53 +08:00
|
|
|
/1/, /2/, /3/, /4/, /5/, /6/, /7/, /8/, /9/, /10/
|
2011-09-27 14:25:31 +08:00
|
|
|
]);
|
|
|
|
|
|
|
|
// Continue
|
|
|
|
addTest('c', [
|
2015-04-22 00:34:52 +08:00
|
|
|
/break in timers.js:\d+/,
|
2011-09-29 02:17:12 +08:00
|
|
|
/\d/, /\d/, /\d/, /\d/, /\d/
|
2011-09-27 14:25:31 +08:00
|
|
|
]);
|
|
|
|
|
2015-04-22 00:34:52 +08:00
|
|
|
// Execute
|
|
|
|
addTest('exec process.title', [
|
2017-01-04 03:24:27 +08:00
|
|
|
common.isFreeBSD || common.isOSX || common.isLinux ? /node/ : ''
|
2015-04-22 00:34:52 +08:00
|
|
|
]);
|
|
|
|
|
|
|
|
// Execute
|
|
|
|
addTest('exec exec process.title', [
|
|
|
|
/SyntaxError: Unexpected identifier/
|
|
|
|
]);
|
|
|
|
|
2014-04-27 16:42:43 +08:00
|
|
|
// REPL and process.env regression
|
|
|
|
addTest('repl', [
|
|
|
|
/Ctrl/
|
|
|
|
]);
|
|
|
|
|
|
|
|
addTest('for (var i in process.env) delete process.env[i]', []);
|
|
|
|
|
|
|
|
addTest('process.env', [
|
|
|
|
/\{\}/
|
|
|
|
]);
|
2016-04-29 00:26:29 +08:00
|
|
|
|
|
|
|
addTest('arr = [{foo: "bar"}]', [
|
|
|
|
/\[ \{ foo: 'bar' \} \]/
|
|
|
|
]);
|