]> code.delx.au - gnu-emacs-elpa/blob - packages/realgud/test/test-regexp-zshdb.el
Add 'packages/realgud/' from commit 'd811316e6a0f4eeee8a1347f504c196c86baa2cb'
[gnu-emacs-elpa] / packages / realgud / test / test-regexp-zshdb.el
1 (require 'test-simple)
2 (load-file "../realgud/debugger/zshdb/init.el")
3 (load-file "./regexp-helper.el")
4
5 (test-simple-start)
6
7 (setq prompt-pat (gethash "prompt" realgud:zshdb-pat-hash))
8 (setq frame-pat (gethash "debugger-backtrace" realgud:zshdb-pat-hash))
9
10 (note "zshdb prompt matching")
11 (prompt-match "zshdb<10> " "10")
12 (prompt-match "zshdb<(5)> " "5" "subshell prompt %s")
13 (prompt-match "zshdb<<1>> " "1" "nested debug prompt %s")
14
15 (note "zshdb frame matching")
16
17 (note "debugger-backtrace")
18 (setq s1
19 "->0 in file `/etc/apparmor/functions' at line 24
20 ##1 /etc/apparmor/functions called from file `/etc/init.d/apparmor' at line 35
21 ##2 /etc/init.d/apparmor called from file `/usr/local/bin/zshdb' at line 129
22 ")
23 (setq frame-re (realgud-loc-pat-regexp frame-pat))
24 (setq num-group (realgud-loc-pat-num frame-pat))
25 (setq file-group (realgud-loc-pat-file-group frame-pat))
26 (setq line-group (realgud-loc-pat-line-group frame-pat))
27 (assert-equal 0 (string-match frame-re s1))
28 (assert-equal "0" (substring s1
29 (match-beginning num-group)
30 (match-end num-group)))
31 (assert-equal "/etc/apparmor/functions"
32 (substring s1
33 (match-beginning file-group)
34 (match-end file-group)))
35 (assert-equal "24"
36 (substring s1
37 (match-beginning line-group)
38 (match-end line-group)))
39 (setq pos (match-end 0))
40
41 (assert-equal 49 (string-match frame-re s1 pos))
42 (assert-equal "1" (substring s1
43 (match-beginning num-group)
44 (match-end num-group)))
45 (assert-equal "/etc/init.d/apparmor"
46 (substring s1
47 (match-beginning file-group)
48 (match-end file-group)))
49 (assert-equal "35"
50 (substring s1
51 (match-beginning line-group)
52 (match-end line-group)))
53 (setq pos (match-end 0))
54 (assert-equal 128 (string-match frame-re s1 pos))
55 (assert-equal "2" (substring s1
56 (match-beginning num-group)
57 (match-end num-group)))
58 (assert-equal "/usr/local/bin/zshdb"
59 (substring s1
60 (match-beginning file-group)
61 (match-end file-group)))
62 (assert-equal "129"
63 (substring s1
64 (match-beginning line-group)
65 (match-end line-group)))
66
67 (end-tests)