2 (load-file "../realgud/debugger/nodejs/init.el")
3 (load-file "./regexp-helper.el")
5 (declare-function realgud-cmdbuf-info-loc-regexp 'realgud-buffer-command)
6 (declare-function cmdbuf-loc-match 'realgud-regexp)
7 (declare-function loc-match 'realgud-helper)
8 (declare-function prompt-match 'regexp-helper)
9 (declare-function realgud-loc-pat-num 'realgud-regexp)
10 (declare-function realgud-loc-pat-regexp 'realgud-regexp)
11 (declare-function realgud-loc-pat-file-group 'realgud-regexp)
12 (declare-function realgud-loc-pat-line-group 'realgud-regexp)
13 (declare-function __FILE__ 'load-relative)
21 (defvar realgud:nodejs-pat-hash)
22 (defvar realgud-pat-hash)
27 (note "nodejs prompt matching")
28 (set (make-local-variable 'prompt-pat)
29 (gethash "prompt" realgud:nodejs-pat-hash))
30 (prompt-match "debug> ")
31 (prompt-match "
\e[1G
\e[0Jdebug>
\e[8G
\e[1G
\e[0Kconnecting... ok")
33 (note "nodejs location matching")
34 (setq dbg-name "nodejs")
35 (setq loc-pat (gethash "loc" (gethash dbg-name realgud-pat-hash)))
37 (setq test-dbgr (make-realgud-cmdbuf-info
38 :debugger-name dbg-name
39 :loc-regexp (realgud-loc-pat-regexp loc-pat)
40 :file-group (realgud-loc-pat-file-group loc-pat)
41 :line-group (realgud-loc-pat-line-group loc-pat)))
43 (setq test-text "break in test/fixtures/break-in-module/main.js:1\n")
44 (assert-t (numberp (cmdbuf-loc-match test-text test-dbgr)) "basic location")
46 (string-match (realgud-cmdbuf-info-loc-regexp test-dbgr) test-text)
47 (assert-equal "test/fixtures/break-in-module/main.js"
48 (match-string (realgud-cmdbuf-info-file-group test-dbgr)
51 (string-match (realgud-cmdbuf-info-loc-regexp test-dbgr) test-text)
54 (realgud-cmdbuf-info-line-group test-dbgr)
55 test-text) "extract line number")