]> code.delx.au - gnu-emacs-elpa/blob - packages/realgud/test/test-loc.el
Add 'packages/realgud/' from commit 'd811316e6a0f4eeee8a1347f504c196c86baa2cb'
[gnu-emacs-elpa] / packages / realgud / test / test-loc.el
1 (require 'test-simple)
2 (load-file "../realgud/common/buffer/source.el")
3 (load-file "../realgud/common/loc.el")
4
5 (declare-function __FILE__ 'load-relative)
6 (declare-function make-realgud-loc 'realgud-loc)
7 (declare-function realgud-loc-cmd-marker 'realgud-loc)
8 (declare-function realgud-loc-line-number 'realgud-loc)
9 (declare-function realgud-loc-marker 'realgud-loc)
10 (declare-function realgud-loc-marker= 'realgud-loc)
11
12 (test-simple-start)
13
14 (save-current-buffer
15
16 ;; Below, we need to make sure current-buffer has an associated
17 ;; file with it.
18 (find-file (symbol-file 'test-simple))
19
20 (note "location field extraction")
21 (let* ((buff (current-buffer))
22 (filename (buffer-file-name buff))
23 (source-marker (point-marker))
24 (cmd-marker (point-marker))
25 (good-loc (make-realgud-loc
26 :filename filename
27 :line-number 5
28 :marker source-marker
29 :cmd-marker cmd-marker
30 ))
31 (good-loc2 (make-realgud-loc
32 :filename filename
33 :line-number 6
34 :marker source-marker
35 :cmd-marker cmd-marker
36 ))
37 ;; (good-loc3 (realgud-loc-current buff cmd-marker))
38 )
39
40 (assert-equal 5 (realgud-loc-line-number good-loc) "line-number extraction")
41
42 (assert-equal source-marker (realgud-loc-marker good-loc)
43 "source code marker extraction")
44
45
46 (assert-equal cmd-marker (realgud-loc-cmd-marker good-loc)
47 "command process marker extraction")
48
49
50 (realgud-loc-marker= good-loc2 source-marker)
51 (assert-equal source-marker (realgud-loc-marker good-loc2)
52 "marker set")
53
54 ))
55
56 (end-tests)
57
58 ; TODO: add test for debug-loc-goto, e.g.
59 ;(realgud-loc-goto (realgud-loc-new "/tmp/bashdb.diff" 8))
60 ;(realgud-loc-goto (realgud-loc-new "/tmp/bashdb.diff" 8) 'other-window 1)