]> code.delx.au - gnu-emacs-elpa/blob - packages/realgud/test/test-regexp-remake.el
Add 'packages/realgud/' from commit 'd811316e6a0f4eeee8a1347f504c196c86baa2cb'
[gnu-emacs-elpa] / packages / realgud / test / test-regexp-remake.el
1 (require 'test-simple)
2 (load-file "../realgud/debugger/remake/init.el")
3 (load-file "./regexp-helper.el")
4
5 (test-simple-start)
6
7 (set (make-local-variable 'prompt-pat)
8 (gethash "prompt" realgud:remake-pat-hash))
9 (set (make-local-variable 'frame-pat)
10 (gethash "debugger-backtrace" realgud:remake-pat-hash))
11
12 (note "remake prompt")
13 (prompt-match "remake<10> " "10")
14 (prompt-match "remake<<1>> " "1" "recursive remake %s")
15
16 (note "remake debugger-backtrace")
17 (setq s1
18 "=>#0 Makefile.in at /tmp/Makefile:216
19 #1 Makefile at /tmp/Makefile:230
20 ")
21
22 (set (make-local-variable 'frame-re)
23 (realgud-loc-pat-regexp frame-pat))
24 (set (make-local-variable 'num-group)
25 (realgud-loc-pat-num frame-pat))
26 (set (make-local-variable 'file-group)
27 (realgud-loc-pat-file-group frame-pat))
28 (set (make-local-variable 'line-group)
29 (realgud-loc-pat-line-group frame-pat))
30
31 (assert-equal 0 (string-match frame-re s1))
32 (assert-equal "0" (substring s1
33 (match-beginning num-group)
34 (match-end num-group)))
35 (assert-equal "/tmp/Makefile"
36 (substring s1
37 (match-beginning file-group)
38 (match-end file-group)))
39 (assert-equal "216"
40 (substring s1
41 (match-beginning line-group)
42 (match-end line-group)))
43 (set (make-local-variable 'pos)
44 (match-end 0))
45
46 (assert-equal 39 (string-match frame-re s1 pos))
47 (assert-equal "1" (substring s1
48 (match-beginning num-group)
49 (match-end num-group)))
50 (assert-equal "/tmp/Makefile"
51 (substring s1
52 (match-beginning file-group)
53 (match-end file-group)))
54 (assert-equal "230"
55 (substring s1
56 (match-beginning line-group)
57 (match-end line-group)))
58
59 (end-tests)