1
// Copyright Joyent, Inc. and other Node contributors.
3
// Permission is hereby granted, free of charge, to any person obtaining a
4
// copy of this software and associated documentation files (the
5
// "Software"), to deal in the Software without restriction, including
6
// without limitation the rights to use, copy, modify, merge, publish,
7
// distribute, sublicense, and/or sell copies of the Software, and to permit
8
// persons to whom the Software is furnished to do so, subject to the
9
// following conditions:
11
// The above copyright notice and this permission notice shall be included
12
// in all copies or substantial portions of the Software.
14
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
17
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
18
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
19
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
20
// USE OR OTHER DEALINGS IN THE SOFTWARE.
22
var repl = require('./helper-debugger-repl.js');
24
repl.startDebugger('break-in-module/main.js');
26
// -- SET BREAKPOINT --
28
// Set breakpoint by file name + line number where the file is not loaded yet
29
repl.addTest('sb("mod.js", 23)', [
30
/Warning: script 'mod\.js' was not loaded yet\./,
31
/1/, /2/, /3/, /4/, /5/, /6/
34
// Check escaping of regex characters
35
repl.addTest('sb(")^$*+?}{|][(.js\\\\", 1)', [
36
/Warning: script '[^']+' was not loaded yet\./,
37
/1/, /2/, /3/, /4/, /5/, /6/
40
// continue - the breakpoint should be triggered
42
/break in .*[\\\/]mod\.js:23/,
43
/21/, /22/, /23/, /24/, /25/
46
// -- RESTORE BREAKPOINT ON RESTART --
48
// Restart the application - breakpoint should be restored
49
repl.addTest('restart', [].concat(
55
/Restoring breakpoint mod.js:23/,
56
/Warning: script 'mod\.js' was not loaded yet\./,
57
/Restoring breakpoint \).*:\d+/,
58
/Warning: script '\)[^']*' was not loaded yet\./
60
repl.initialBreakLines));
62
// continue - the breakpoint should be triggered
64
/break in .*[\\\/]mod\.js:23/,
65
/21/, /22/, /23/, /24/, /25/
68
// -- CLEAR BREAKPOINT SET IN MODULE TO BE LOADED --
70
repl.addTest('cb("mod.js", 23)', [
71
/18/, /./, /./, /./, /./, /./, /./, /./, /26/
75
/break in .*[\\\/]main\.js:4/,
76
/2/, /3/, /4/, /5/, /6/
80
repl.addTest('quit', []);