2 (load-file "../realgud/debugger/pdb/init.el")
3 (load-file "./regexp-helper.el")
5 (declare-function __FILE__ 'load-relative)
6 (declare-function prompt-match 'regexp-helper)
11 (defvar loc-pat) (defvar prompt-pat) (defvar realgud:pdb-pat-hash)
12 (defvar tb-pat) (defvar test-text) (defvar prompt-str)
16 (set (make-local-variable 'bps-pat)
17 (gethash "brkpt-set" realgud:pdb-pat-hash))
19 (set (make-local-variable 'loc-pat)
20 (gethash "loc" realgud:pdb-pat-hash))
22 (set (make-local-variable 'prompt-pat)
23 (gethash "prompt" realgud:pdb-pat-hash))
25 (set (make-local-variable 'tb-pat)
26 (gethash "lang-backtrace" realgud:pdb-pat-hash))
28 ;; FIXME: we get a void variable somewhere in here when running
29 ;; even though we define it in lexical-let. Dunno why.
30 ;; setq however will workaround this.
32 " File \"/usr/lib/python2.6/code.py\", line 281, in raw_input")
33 (note "traceback location matching")
35 (assert-t (numberp (loc-match test-text tb-pat)) "basic traceback location")
37 (assert-equal "/usr/lib/python2.6/code.py"
38 (match-string (realgud-loc-pat-file-group tb-pat)
42 " File \"/usr/lib/python2.6/code.py\", line 281, in raw_input")
43 (loc-match test-text tb-pat)
45 (match-string (realgud-loc-pat-line-group tb-pat)
46 test-text) "extract line number")
48 (note "breakpoint location matching")
50 (setq test-text "Breakpoint 1 at /src/git/code/gcd.py:13")
51 (assert-t (numberp (loc-match test-text bps-pat))
52 "basic breakpoint location")
54 (assert-equal "/src/git/code/gcd.py"
55 (match-string (realgud-loc-pat-file-group
58 "extract breakpoint file name")
62 (match-string (realgud-loc-pat-line-group
64 test-text) "extract breakpoint line number")
66 ;; (set test-text "(c:\\working\\python\\helloworld.py:30): <module>")
68 ;; (assert-t (numberp (loc-match test-text loc-pat)) "MS DOS position location")
70 ;; (assert-equal "c:\\working\\python\\helloworld.py"
71 ;; (match-string (realgud-loc-pat-file-group loc-pat)
73 ;; (format "Failing file group is %s"
74 ;; (realgud-loc-pat-file-group tb-pat))
75 ;; "extract file name")
77 ;; (match-string (realgud-loc-pat-line-group loc-pat)
78 ;; test-text) "extract line number")
80 (setq test-text "> /usr/bin/ipython(24)<module>")
81 (assert-t (numberp (loc-match test-text loc-pat)) "position location")
82 (assert-equal "/usr/bin/ipython"
83 (match-string (realgud-loc-pat-file-group loc-pat)
85 (format "Failing file group is %s"
86 (realgud-loc-pat-file-group tb-pat)))
88 (match-string (realgud-loc-pat-line-group
91 "extract line number")
94 (note "prompt matching")
95 (set (make-local-variable 'prompt-str) "(Pdb) ")
96 (prompt-match prompt-str nil "debugger prompt: %s")
97 (setq prompt-str "((Pdb)) ")
98 (prompt-match prompt-str nil "nested debugger prompt: %s")
99 (setq prompt-str "Pdb) ")
100 (assert-nil (numberp (loc-match prompt-str prompt-pat))
101 (format "%s %s" "invalid debugger prompt"