]> code.delx.au - gnu-emacs-elpa/blob - packages/realgud/test/test-regexp-trepanpl.el
b09ea22479234fc7a3a3214988ac59521f9b9658
[gnu-emacs-elpa] / packages / realgud / test / test-regexp-trepanpl.el
1 (require 'test-simple)
2 (require 'load-relative)
3 (load-file "../realgud/debugger/trepan.pl/init.el")
4 (load-file "./regexp-helper.el")
5
6 (eval-when-compile
7 (defvar realgud:trepanpl-pat-hash)
8 (defvar prompt-str)
9 (defvar test-dbgr)
10 (defvar carp-bt-re)
11 (defvar file-group)
12 (defvar line-group)
13 (defvar test-text)
14 (defvar dbg-bt-pat)
15 (defvar bps-pat)
16 (defvar realgud-bt-pat)
17 (defvar realgud-perl-ignnore-file-re)
18 )
19 (declare-function __FILE__ 'load-relative)
20
21 (test-simple-start)
22
23 (set (make-local-variable 'helper-bps)
24 (gethash "brkpt-set" realgud:trepanpl-pat-hash))
25 (set (make-local-variable 'prompt)
26 (gethash "prompt" realgud:trepanpl-pat-hash))
27 (set (make-local-variable 'helper-tb)
28 (gethash "lang-backtrace" realgud:trepanpl-pat-hash))
29
30
31 (note "prompt matching")
32 (set (make-local-variable 'prompt-pat)
33 (gethash "prompt" realgud:trepanpl-pat-hash))
34 (prompt-match "(trepanpl): ")
35 (prompt-match "((trepanpl)): " nil "nested debugger prompt: %s")
36 (setq prompt-str "trepanpl:")
37 (assert-nil (loc-match prompt-str prompt-pat)
38 (format "invalid prompt %s" prompt-str))
39
40 (setq test-text "Breakpoint 2 set in /tmp/File/Basename.pm at line 215")
41
42 (assert-t (numberp (bp-loc-match test-text))
43 "basic breakpoint location")
44 (assert-equal "/tmp/File/Basename.pm"
45 (match-string (realgud-loc-pat-file-group helper-bps)
46 test-text)
47 "extract breakpoint file name"
48 )
49 (assert-equal "215"
50 (match-string (realgud-loc-pat-line-group helper-bps)
51 test-text)
52 "extract breakpoint line number"
53 )
54
55 (setq test-text "Breakpoint 1 set in (eval 1177)[/Eval.pm:94] at line 5")
56 (assert-t (numberp (bp-loc-match test-text)) "eval breakpoint location")
57 (setq bps-pat
58 (gethash "brkpt-set" realgud:trepanpl-pat-hash))
59 (setq dbg-bt-pat
60 (gethash "debugger-backtrace" realgud:trepanpl-pat-hash))
61 (setq prompt-pat
62 (gethash "prompt" realgud:trepanpl-pat-hash))
63 (setq lang-bt-pat
64 (gethash "lang-backtrace" realgud:trepanpl-pat-hash))
65
66 (note "prompt")
67 (prompt-match "(trepanpl): ")
68 (prompt-match "((trepanpl)): " nil "nested debugger prompt: %s")
69
70 (setq test-text "Breakpoint 1 set in /tmp/gcd.pl at line 9")
71
72 (assert-t (numberp (loc-match test-text bps-pat))
73 "basic breakpoint location")
74
75
76 (assert-equal "/tmp/gcd.pl"
77 (match-string (realgud-loc-pat-file-group
78 bps-pat) test-text)
79 "extract breakpoint file name")
80
81 (assert-equal "9"
82 (match-string (realgud-loc-pat-line-group
83 bps-pat) test-text)
84 "extract breakpoint line number")
85
86 (end-tests)