]> code.delx.au - gnu-emacs-elpa/blob - test/test-loc-regexp-trepan.el
Set debug-track-mode properly.
[gnu-emacs-elpa] / test / test-loc-regexp-trepan.el
1 (require 'test-unit)
2 (load-file "../dbgr/common/buffer/command.el")
3 (load-file "../dbgr/debugger/trepan/init.el")
4
5 (test-unit-clear-contexts)
6
7
8 ; Some setup usually done in setting up the buffer.
9 ; We customize this for the debugger trepan. Others may follow.
10 ; FIXME: encapsulate this.
11 (setq dbg-name "trepan")
12 (setq loc-pat (gethash "loc" (gethash dbg-name dbgr-pat-hash)))
13
14 (setq dbgr (make-dbgr-cmdbuf-info
15 :debugger-name dbg-name
16 :loc-regexp (dbgr-loc-pat-regexp loc-pat)
17 :file-group (dbgr-loc-pat-file-group loc-pat)
18 :line-group (dbgr-loc-pat-line-group loc-pat)))
19
20
21 (defun loc-match(text)
22 (string-match (dbgr-cmdbuf-info-loc-regexp dbgr) text)
23 )
24
25 (context "location matching"
26 (tag loc-regexp-trepan)
27
28 (specify "basic location"
29 (setq text "-- (/usr/local/bin/irb:9 @2)")
30 (assert-t (numberp (loc-match text)))
31 )
32 (specify "extract file name"
33 (assert-equal 0 (loc-match text))
34 (assert-equal "/usr/local/bin/irb"
35 (match-string (dbgr-cmdbuf-info-file-group dbgr)
36 text))
37 )
38 (specify "extract line number"
39 (assert-equal "9"
40 (match-string
41 (dbgr-cmdbuf-info-line-group dbgr)
42 text))
43 )
44
45 )
46
47 (context "location remap matching"
48 (tag loc-regexp-trepan)
49
50 (specify "remapped location"
51 (setq text "-> (<internal:lib/rubygems/custom_require>:28 remapped /usr/lib/ruby/gems/1.9.1/gems/data/custom_require.rb:28 @2)")
52 (assert-t (numberp (loc-match text)))
53 )
54 (specify "extract remapped file name"
55 (assert-equal 0 (loc-match text))
56 (assert-equal "/usr/lib/ruby/gems/1.9.1/gems/data/custom_require.rb"
57 (match-string (dbgr-cmdbuf-info-file-group dbgr)
58 text))
59 )
60 (specify "extract remapped line number"
61 (assert-equal "28"
62 (match-string
63 (dbgr-cmdbuf-info-line-group dbgr)
64 text))
65 )
66
67 )
68
69
70 (context "location matching c-func"
71 (tag loc-regexp-trepan)
72
73 (specify "basic location for C fn"
74 (setq text "C> (/tmp/c-func.rb:2)")
75 (assert-t (numberp (loc-match text)))
76 )
77 (specify "extract file name for C fn"
78 (assert-equal 0 (loc-match text))
79 (assert-equal "/tmp/c-func.rb"
80 (match-string (dbgr-cmdbuf-info-file-group dbgr)
81 text))
82 )
83 (specify "extract line number for C fn"
84 (assert-equal "2"
85 (match-string
86 (dbgr-cmdbuf-info-line-group dbgr)
87 text))
88 )
89 )
90
91
92 (test-unit "loc-regexp-trepan")
93