2 (load-file "../dbgr/common/buffer/command.el")
3 (load-file "../dbgr/debugger/trepan/init.el")
5 (test-unit-clear-contexts)
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)))
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)))
21 (defun loc-match(text)
22 (string-match (dbgr-cmdbuf-info-loc-regexp dbgr) text)
25 (context "location matching"
26 (tag loc-regexp-trepan)
28 (specify "basic location"
29 (setq text "-- (/usr/local/bin/irb:9 @2)")
30 (assert-t (numberp (loc-match text)))
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)
38 (specify "extract line number"
41 (dbgr-cmdbuf-info-line-group dbgr)
47 (context "location remap matching"
48 (tag loc-regexp-trepan)
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)))
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)
60 (specify "extract remapped line number"
63 (dbgr-cmdbuf-info-line-group dbgr)
70 (context "location matching c-func"
71 (tag loc-regexp-trepan)
73 (specify "basic location for C fn"
74 (setq text "C> (/tmp/c-func.rb:2)")
75 (assert-t (numberp (loc-match text)))
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)
83 (specify "extract line number for C fn"
86 (dbgr-cmdbuf-info-line-group dbgr)
92 (test-unit "loc-regexp-trepan")