]> code.delx.au - gnu-emacs-elpa/blob - test/test-trepanpl.el
Fix breakage from changing from realgud:string-starts-with to string-prefix-p
[gnu-emacs-elpa] / test / test-trepanpl.el
1 (require 'test-simple)
2 (load-file "../realgud/common/buffer/command.el")
3 (load-file "../realgud/debugger/trepan.pl/trepanpl.el")
4
5 (eval-when-compile (defvar test:run-process-save))
6
7 (declare-function realgud:trepanpl-parse-cmd-args 'realgud:trepanpl)
8 (declare-function realgud:trepan.pl 'realgud:trepanpl)
9 (declare-function __FILE__ 'require-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 minibuf-history
17 &optional no-reset)
18 "Fake realgud:run-process used in testing"
19 (note
20 (format "%s %s %s" debugger-name script-filename cmd-args))
21 (assert-equal "trepan.pl" debugger-name "debugger name gets passed")
22 (let ((expanded-name (expand-file-name "./gcd.pl")))
23 (assert-equal expanded-name script-filename "file name check")
24 (assert-equal (list "-I" (expand-file-name ".") expanded-name "3" "5")
25 (cdr cmd-args) "command args listified")
26 )
27 nil ;; Make sure trepanpl doesn't try to do anything with cmdbuf
28 )
29
30 (note "realgud:trepanpl-parse-cmd-args")
31 (assert-equal (list nil '("trepan.pl") '("foo"))
32 (realgud:trepanpl-parse-cmd-args '("trepan.pl" "foo")))
33 (assert-equal (list '("perl5.8") '("trepan.pl") '("foo"))
34 (realgud:trepanpl-parse-cmd-args '("perl5.8" "trepan.pl" "foo")))
35 (assert-equal (list nil '("trepan.pl") '("program.pl" "foo"))
36 (realgud:trepanpl-parse-cmd-args
37 '("trepan.pl" "program.pl" "foo")))
38 (assert-equal (list nil '("trepan.pl") (list (expand-file-name "gcd.pl") "foo"))
39 (realgud:trepanpl-parse-cmd-args
40 '("trepan.pl" "gcd.pl" "foo")))
41
42 (realgud:trepan.pl "trepanpl -I . ./gcd.pl 3 5")
43
44 ;; Restore the old value of realgud:run-process
45 (fset 'realgud:run-process test:run-process-save)
46
47 (end-tests)