2 (eval-when-compile (defvar trepan-core))
4 (declare-function __FILE__ 'load-relative)
5 (setq trepan-core "../realgud/debugger/trepan/core.el")
6 (load-file "../realgud/common/core.el")
8 (declare-function realgud:expand-file-name-if-exists 'realgud-core)
9 (declare-function realgud-parse-command-arg, 'realgud-core)
10 (declare-function realgud:trepan-parse-cmd-args 'realgud:trepan)
12 ;; We use a specific language to test core. Here we use trepan.
13 (load-file "../realgud/debugger/trepan/core.el")
17 ;; FIXME: Add a test of relgud-exec-shell where
18 ;; we have two invocation of different files that canonicalize
19 ;; to the same buffer. Make sure the buffers are distinct.
20 ;; For example: bashdb /etc/profile should not match
21 ;; bashdb /tmp/profile
23 (note "realgud:expand-file-name-if-exists")
25 (assert-equal (realgud:expand-file-name-if-exists "file-not-here")
26 "file-not-here" "no expansion when expanded file doesn't exist")
28 (assert-equal (realgud:expand-file-name-if-exists ".")
29 (expand-file-name "."))
31 (note "realgud-parse-...")
33 (lexical-let ((opt-two-args '("0" "C" "e" "E" "F" "i")))
34 (assert-equal '(("-0" "a") nil)
35 (realgud-parse-command-arg '("-0" "a") '() opt-two-args)
36 "Two args found, none remain afterwards though.")
40 (realgud-parse-command-arg '("-5" "a" "-0") '()
46 (realgud-parse-command-arg '() '() opt-two-args)
47 "Degenerate case - no args"
51 '(("--port" "123") ("bar"))
52 (realgud-parse-command-arg
53 '("--port" "123" "bar") '("-port") '())
58 '(("/usr/bin/ruby1.9" "-W") ("trepan") ("foo") nil)
59 (realgud:trepan-parse-cmd-args
60 '("/usr/bin/ruby1.9" "-W" "trepan" "foo"))
61 "Separate Ruby with its arg from debugger and its arg.")
64 '(("ruby1.9" "-T3") ("trepan" "--port" "123") ("bar") nil)
65 (realgud:trepan-parse-cmd-args
66 '("ruby1.9" "-T3" "trepan" "--port" "123" "bar"))
67 "Ruby with two args and trepan with two args")
70 '(nil ("trepan" "--port" "1" "--annotate=3")
72 (realgud:trepan-parse-cmd-args
73 '("trepan" "--port" "1" "--annotate=3" "foo" "a"))
74 "trepan with annotate args")
77 '(nil ("trepan" "--port" "123")
78 ("foo" "--emacs" "a") nil)
79 (realgud:trepan-parse-cmd-args
80 '("trepan" "--port" "123" "foo" "--emacs" "a"))
81 "trepan with --emacs in the wrong place")
84 '(("ruby" "-I/usr/lib/ruby")
85 ("trepan" "-h" "foo" "--emacs")
87 (realgud:trepan-parse-cmd-args
88 '("ruby" "-I/usr/lib/ruby" "trepan" "-h" "foo"