]> code.delx.au - gnu-emacs-elpa/blob - packages/realgud/test/test-loc-regexp-trepanx.el
Add 'packages/realgud/' from commit 'd811316e6a0f4eeee8a1347f504c196c86baa2cb'
[gnu-emacs-elpa] / packages / realgud / test / test-loc-regexp-trepanx.el
1 (require 'test-simple)
2 (require 'load-relative)
3 (load-file "./regexp-helper.el")
4 (load-file "../realgud/common/regexp.el")
5 (load-file "../realgud/debugger/trepanx/init.el")
6
7 (declare-function realgud-cmdbuf-info-loc-regexp 'realgud-buffer-command)
8 (declare-function cmdbuf-loc-match 'realgud-regexp)
9 (declare-function realgud-loc-pat-regexp 'realgud-regexp)
10 (declare-function realgud-loc-pat-file-group 'realgud-regexp)
11 (declare-function realgud-loc-pat-line-group 'realgud-regexp)
12 (declare-function realgud-cmdbuf-info-file-group 'realgud-regexp)
13 (declare-function realgud-cmdbuf-info-line-group 'realgud-regexp)
14 (declare-function realgud-cmdbuf-info 'realgud-regexp)
15 (declare-function make-realgud-cmdbuf-info 'realgud-regexp)
16 (declare-function __FILE__ 'require-relative)
17
18 (test-simple-start)
19
20 (eval-when-compile
21 (defvar dbg-name)
22 (defvar realgud-pat-hash)
23 (defvar loc-pat)
24 (defvar test-dbgr)
25 (defvar test-text)
26 (defvar xagent-pat)
27 )
28
29 ;; Some setup usually done in setting up the buffer.
30 ;; We customize this for the debugger trepan. Others may follow.
31 ;; FIXME: encapsulate this.
32 (setq dbg-name "trepanx")
33 (setq loc-pat (gethash "loc" (gethash dbg-name realgud-pat-hash)))
34 (setq xagent-pat (gethash "rubinius-backtrace-Xagent" (gethash dbg-name realgud-pat-hash)))
35
36 (setq test-dbgr (make-realgud-cmdbuf-info
37 :debugger-name dbg-name
38 :loc-regexp (realgud-loc-pat-regexp loc-pat)
39 :file-group (realgud-loc-pat-file-group loc-pat)
40 :line-group (realgud-loc-pat-line-group loc-pat)))
41
42
43 (defun xagent-match(text)
44 (string-match (realgud-loc-pat-regexp xagent-pat) test-text)
45 )
46
47 (setq test-text "-- (../rbx-trepanning/tmp/rbxtest.rb:7 @5)")
48 (assert-t (numberp (cmdbuf-loc-match test-text test-dbgr)) "basic location")
49
50 (note "extract file name")
51 (setq test-text "-- (../rbx-trepanning/tmp/rbxtest.rb:7 @5)")
52 (assert-equal 0 (cmdbuf-loc-match test-text test-dbgr))
53 (assert-equal "../rbx-trepanning/tmp/rbxtest.rb"
54 (match-string (realgud-cmdbuf-info-file-group test-dbgr)
55 test-text))
56 (setq test-text "-- (../rbx-trepanning/tmp/rbxtest.rb:7 @5)")
57 (assert-equal "7"
58 (match-string
59 (realgud-cmdbuf-info-line-group test-dbgr)
60 test-text) "extract line number")
61
62 (setq test-text "0xbfb63710: RakeFileUtils#ruby in /home/rocky-rvm/.rvm/gems/rbx-head/gems/rake-0.8.7/lib/rake.rb:1094 (+61)")
63 (assert-t (numberp (xagent-match test-text)) "basic xagent location")
64
65 (end-tests)