]> code.delx.au - gnu-emacs-elpa/blob - packages/realgud/test/test-regexp-trepanx.el
41bc9d6691357dae61b5488aa07639303b08b89e
[gnu-emacs-elpa] / packages / realgud / test / test-regexp-trepanx.el
1 (load-file "../realgud/debugger/trepanx/init.el")
2 (load-file "./regexp-helper.el")
3
4 (test-simple-start)
5
6 (set (make-local-variable 'helper-bps)
7 (gethash "brkpt-set" realgud:trepanx-pat-hash))
8 (set (make-local-variable 'prompt)
9 (gethash "prompt" realgud:trepanx-pat-hash))
10 (set (make-local-variable 'helper-tb)
11 (gethash "lang-backtrace" realgud:trepanx-pat-hash))
12
13 ;; FIXME: we get a void variable somewhere in here when running
14 ;; even though we define it in lexical-let. Dunno why.
15 ;; setq however will workaround this.
16 (set (make-local-variable 'text)
17 " \e[0;31m Object#boom at tmp/boom.rb:2\e[0m")
18
19 (assert-t (numberp (tb-loc-match text))
20 "basic traceback location")
21
22 (assert-equal 0 (tb-loc-match text)
23 "match trepanx location")
24 (assert-equal "tmp/boom.rb"
25 (match-string (realgud-loc-pat-file-group helper-tb)
26 text)
27 "extract traceback file name")
28 (setq text
29 " { } in main.__script__ at /tmp/blam.rb:5")
30 (assert-equal 0 (tb-loc-match text)
31 "find a trepanx location")
32 (assert-equal "/tmp/blam.rb"
33 (match-string (realgud-loc-pat-file-group helper-tb)
34 text)
35 "extract traceback file name")
36
37 (assert-equal "5"
38 (match-string (realgud-loc-pat-line-group helper-tb)
39 text)
40 "extract traceback line number")
41
42 (note "prompt matching")
43 (set (make-local-variable 'prompt-pat)
44 (gethash "prompt" realgud:trepanx-pat-hash))
45 (prompt-match "((trepanx)): " nil "nested debugger prompt: %s")
46 (prompt-match "((trepanx@55)): "
47 "@55" "nested debugger prompt with addr: %s")
48 (prompt-match "((trepanx@main)): " "@main"
49 "nested debugger prompt with method: %s")
50 (setq prompt-str "trepanx:")
51 (assert-nil (loc-match prompt-str prompt-pat)
52 (format "invalid prompt %s" prompt-str))
53
54 (setq text "Set breakpoint 1: __script__() at /bin/irb:2 (@0)")
55
56 (assert-t (numberp (bp-loc-match text))
57 "basic breakpoint location")
58 (assert-equal "/bin/irb"
59 (match-string (realgud-loc-pat-file-group helper-bps)
60 text)
61 "extract breakpoint file name"
62 )
63 (assert-equal "2"
64 (match-string (realgud-loc-pat-line-group helper-bps)
65 text)
66 "extract breakpoint line number"
67 )
68
69 (end-tests)