]> code.delx.au - gnu-emacs-elpa/blob - packages/realgud/test/test-pdb.el
Add 'packages/realgud/' from commit 'd811316e6a0f4eeee8a1347f504c196c86baa2cb'
[gnu-emacs-elpa] / packages / realgud / test / test-pdb.el
1 (require 'test-simple)
2 (require 'load-relative)
3 (load-file "../realgud/debugger/pdb/pdb.el")
4
5 (eval-when-compile (defvar test:run-process-save))
6
7 (declare-function pdb-parse-cmd-args 'realgud:pdb-core)
8 (declare-function realgud:pdb 'realgud:pdb)
9 (declare-function __FILE__ 'load-relative)
10
11 (test-simple-start)
12
13 ;; Save value realgud:run-process and change it to something we want
14 (setq test:run-process-save (symbol-function 'realgud:run-process))
15 (defun realgud:run-process(debugger-name script-filename cmd-args
16 minibuffer-histroy &optional no-reset)
17 "Fake realgud:run-process used in testing"
18 (note
19 (format "%s %s %s" debugger-name script-filename cmd-args))
20 (assert-equal "pdb" debugger-name "debugger name gets passed")
21 (assert-equal (expand-file-name "./gcd.py") script-filename "file name check")
22 (assert-equal '("3" "5") (cddr cmd-args) "command args listified")
23 )
24
25 (note "pdb-parse-cmd-args")
26 (assert-equal (list nil '("pdb") (list (expand-file-name "foo")) nil)
27 (pdb-parse-cmd-args '("pdb" "foo")))
28 (assert-equal (list nil '("pdb") (list (expand-file-name "program.py") "foo") nil)
29 (pdb-parse-cmd-args
30 '("pdb" "program.py" "foo")))
31
32 (realgud:pdb "pdb ./gcd.py 3 5")
33 ;; Restore the old value of realgud:run-process
34 (fset 'realgud:run-process test:run-process-save)
35
36 (end-tests)