]> code.delx.au - gnu-emacs-elpa/blob - test/test-bashdb.el
DRY/fix debugger invocation code. This time, mostly for remake and gdb
[gnu-emacs-elpa] / test / test-bashdb.el
1 (require 'test-simple)
2 (load-file "../realgud/debugger/bashdb/bashdb.el")
3 (load-file "../realgud/common/core.el")
4
5 (declare-function realgud:expand-file-name-if-exists 'realgud-core)
6
7 (eval-when-compile (defvar test:run-process-save))
8
9 (declare-function bashdb-parse-cmd-args 'realgud:bashdb)
10 (declare-function realgud:bashdb 'realgud:bashdb)
11 (declare-function __FILE__ 'require-relative)
12
13 (test-simple-start)
14
15 ;; Save value realgud:run-process and change it to something we want
16 (setq test:run-process-save (symbol-function 'realgud:run-process))
17 (defun realgud:run-process(debugger-name script-filename cmd-args
18 track-mode-func &optional no-reset)
19 "Fake realgud:run-process used in testing"
20 (note
21 (format "%s %s %s %S" debugger-name script-filename cmd-args
22 track-mode-func))
23 (assert-equal "bashdb" debugger-name "debugger name gets passed")
24 (let ((expanded-name
25 (realgud:expand-file-name-if-exists "./gcd.sh")))
26 (assert-equal expanded-name script-filename "file name check")
27 (assert-equal (list "-l" (expand-file-name ".") expanded-name "3" "5")
28 (cdr cmd-args) "command args listified")
29 (assert-equal 'bashdb-track-mode-hook track-mode-func)
30 ))
31
32 (note "bashdb-parse-cmd-args")
33 (assert-equal (list nil '("bashdb")
34 (list (realgud:expand-file-name-if-exists "foo")) nil)
35 (bashdb-parse-cmd-args '("bashdb" "foo")))
36 (assert-equal (list nil '("bashdb")
37 (list (realgud:expand-file-name-if-exists "program.sh")
38 "foo") nil)
39 (bashdb-parse-cmd-args
40 '("bashdb" "program.sh" "foo")))
41
42 (realgud:bashdb "bashdb -l . ./gcd.sh 3 5")
43 ;; Restore the old value of realgud:run-process
44 (fset 'realgud:run-process test:run-process-save)
45
46 (end-tests)