debugger 1.0.0.rc1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/AUTHORS +10 -0
- data/CHANGES +334 -0
- data/ChangeLog +5655 -0
- data/INSTALL.SVN +154 -0
- data/LICENSE +23 -0
- data/Makefile.am +14 -0
- data/OLD_README +122 -0
- data/README.md +10 -0
- data/Rakefile +266 -0
- data/autogen.sh +4 -0
- data/bin/rdebug +398 -0
- data/cli/ruby-debug.rb +173 -0
- data/cli/ruby-debug/command.rb +228 -0
- data/cli/ruby-debug/commands/breakpoints.rb +153 -0
- data/cli/ruby-debug/commands/catchpoint.rb +55 -0
- data/cli/ruby-debug/commands/condition.rb +49 -0
- data/cli/ruby-debug/commands/continue.rb +38 -0
- data/cli/ruby-debug/commands/control.rb +107 -0
- data/cli/ruby-debug/commands/display.rb +120 -0
- data/cli/ruby-debug/commands/edit.rb +48 -0
- data/cli/ruby-debug/commands/enable.rb +202 -0
- data/cli/ruby-debug/commands/eval.rb +176 -0
- data/cli/ruby-debug/commands/finish.rb +42 -0
- data/cli/ruby-debug/commands/frame.rb +301 -0
- data/cli/ruby-debug/commands/help.rb +56 -0
- data/cli/ruby-debug/commands/info.rb +467 -0
- data/cli/ruby-debug/commands/irb.rb +123 -0
- data/cli/ruby-debug/commands/jump.rb +66 -0
- data/cli/ruby-debug/commands/kill.rb +51 -0
- data/cli/ruby-debug/commands/list.rb +94 -0
- data/cli/ruby-debug/commands/method.rb +84 -0
- data/cli/ruby-debug/commands/quit.rb +39 -0
- data/cli/ruby-debug/commands/reload.rb +40 -0
- data/cli/ruby-debug/commands/save.rb +90 -0
- data/cli/ruby-debug/commands/set.rb +221 -0
- data/cli/ruby-debug/commands/show.rb +247 -0
- data/cli/ruby-debug/commands/skip.rb +35 -0
- data/cli/ruby-debug/commands/source.rb +36 -0
- data/cli/ruby-debug/commands/stepping.rb +81 -0
- data/cli/ruby-debug/commands/threads.rb +189 -0
- data/cli/ruby-debug/commands/tmate.rb +36 -0
- data/cli/ruby-debug/commands/trace.rb +57 -0
- data/cli/ruby-debug/commands/variables.rb +199 -0
- data/cli/ruby-debug/debugger.rb +5 -0
- data/cli/ruby-debug/helper.rb +69 -0
- data/cli/ruby-debug/interface.rb +232 -0
- data/cli/ruby-debug/processor.rb +474 -0
- data/configure.ac +12 -0
- data/debugger.gemspec +24 -0
- data/doc/.cvsignore +42 -0
- data/doc/Makefile.am +63 -0
- data/doc/emacs-notes.txt +38 -0
- data/doc/hanoi.rb +35 -0
- data/doc/primes.rb +28 -0
- data/doc/rdebug-emacs.texi +1030 -0
- data/doc/rdebug.1 +241 -0
- data/doc/ruby-debug.texi +3791 -0
- data/doc/test-tri2.rb +18 -0
- data/doc/tri3.rb +8 -0
- data/doc/triangle.rb +12 -0
- data/emacs/Makefile.am +130 -0
- data/emacs/rdebug-annotate.el +385 -0
- data/emacs/rdebug-breaks.el +407 -0
- data/emacs/rdebug-cmd.el +92 -0
- data/emacs/rdebug-core.el +502 -0
- data/emacs/rdebug-dbg.el +62 -0
- data/emacs/rdebug-error.el +79 -0
- data/emacs/rdebug-fns.el +111 -0
- data/emacs/rdebug-frames.el +230 -0
- data/emacs/rdebug-gud.el +242 -0
- data/emacs/rdebug-help.el +104 -0
- data/emacs/rdebug-info.el +83 -0
- data/emacs/rdebug-layouts.el +180 -0
- data/emacs/rdebug-locring.el +118 -0
- data/emacs/rdebug-output.el +106 -0
- data/emacs/rdebug-regexp.el +118 -0
- data/emacs/rdebug-secondary.el +260 -0
- data/emacs/rdebug-shortkey.el +175 -0
- data/emacs/rdebug-source.el +568 -0
- data/emacs/rdebug-track.el +392 -0
- data/emacs/rdebug-varbuf.el +150 -0
- data/emacs/rdebug-vars.el +125 -0
- data/emacs/rdebug-watch.el +132 -0
- data/emacs/rdebug.el +326 -0
- data/emacs/test/elk-test.el +242 -0
- data/emacs/test/test-annotate.el +103 -0
- data/emacs/test/test-cmd.el +116 -0
- data/emacs/test/test-core.el +104 -0
- data/emacs/test/test-fns.el +65 -0
- data/emacs/test/test-frames.el +62 -0
- data/emacs/test/test-gud.el +35 -0
- data/emacs/test/test-indent.el +58 -0
- data/emacs/test/test-regexp.el +144 -0
- data/emacs/test/test-shortkey.el +61 -0
- data/ext/ruby_debug/breakpoint.c +586 -0
- data/ext/ruby_debug/extconf.rb +49 -0
- data/ext/ruby_debug/ruby_debug.c +2624 -0
- data/ext/ruby_debug/ruby_debug.h +148 -0
- data/lib/ChangeLog +1065 -0
- data/lib/debugger.rb +7 -0
- data/lib/debugger/version.rb +3 -0
- data/lib/ruby-debug-base.rb +304 -0
- data/rdbg.rb +33 -0
- data/runner.sh +7 -0
- data/svn2cl_usermap +3 -0
- data/test/.cvsignore +1 -0
- data/test/base/base.rb +74 -0
- data/test/base/binding.rb +31 -0
- data/test/base/catchpoint.rb +26 -0
- data/test/base/load.rb +40 -0
- data/test/bp_loop_issue.rb +3 -0
- data/test/classes.rb +11 -0
- data/test/cli/commands/catchpoint_test.rb +36 -0
- data/test/cli/commands/unit/regexp.rb +42 -0
- data/test/config.yaml +8 -0
- data/test/data/annotate.cmd +29 -0
- data/test/data/annotate.right +139 -0
- data/test/data/break_bad.cmd +18 -0
- data/test/data/break_bad.right +28 -0
- data/test/data/break_loop_bug.cmd +5 -0
- data/test/data/break_loop_bug.right +15 -0
- data/test/data/breakpoints.cmd +38 -0
- data/test/data/breakpoints.right +98 -0
- data/test/data/catch.cmd +20 -0
- data/test/data/catch.right +49 -0
- data/test/data/catch2.cmd +19 -0
- data/test/data/catch2.right +65 -0
- data/test/data/catch3.cmd +11 -0
- data/test/data/catch3.right +37 -0
- data/test/data/condition.cmd +28 -0
- data/test/data/condition.right +65 -0
- data/test/data/ctrl.cmd +23 -0
- data/test/data/ctrl.right +70 -0
- data/test/data/display.cmd +24 -0
- data/test/data/display.right +44 -0
- data/test/data/dollar-0.right +2 -0
- data/test/data/dollar-0a.right +2 -0
- data/test/data/dollar-0b.right +2 -0
- data/test/data/edit.cmd +12 -0
- data/test/data/edit.right +19 -0
- data/test/data/emacs_basic.cmd +43 -0
- data/test/data/emacs_basic.right +106 -0
- data/test/data/enable.cmd +20 -0
- data/test/data/enable.right +36 -0
- data/test/data/finish.cmd +16 -0
- data/test/data/finish.right +31 -0
- data/test/data/frame.cmd +26 -0
- data/test/data/frame.right +55 -0
- data/test/data/help.cmd +20 -0
- data/test/data/help.right +21 -0
- data/test/data/history.right +7 -0
- data/test/data/info-thread.cmd +13 -0
- data/test/data/info-thread.right +37 -0
- data/test/data/info-var-bug2.cmd +5 -0
- data/test/data/info-var-bug2.right +10 -0
- data/test/data/info-var.cmd +23 -0
- data/test/data/info-var.right +52 -0
- data/test/data/info.cmd +21 -0
- data/test/data/info.right +65 -0
- data/test/data/jump.cmd +16 -0
- data/test/data/jump.right +56 -0
- data/test/data/jump2.cmd +16 -0
- data/test/data/jump2.right +44 -0
- data/test/data/linetrace.cmd +6 -0
- data/test/data/linetrace.right +23 -0
- data/test/data/list.cmd +19 -0
- data/test/data/list.right +127 -0
- data/test/data/method.cmd +10 -0
- data/test/data/method.right +21 -0
- data/test/data/methodsig.cmd +10 -0
- data/test/data/methodsig.right +20 -0
- data/test/data/next.cmd +22 -0
- data/test/data/next.right +61 -0
- data/test/data/noquit.right +1 -0
- data/test/data/output.cmd +6 -0
- data/test/data/output.right +31 -0
- data/test/data/pm-bug.cmd +7 -0
- data/test/data/pm-bug.right +12 -0
- data/test/data/post-mortem-next.cmd +8 -0
- data/test/data/post-mortem-next.right +14 -0
- data/test/data/post-mortem-osx.right +31 -0
- data/test/data/post-mortem.cmd +13 -0
- data/test/data/post-mortem.right +32 -0
- data/test/data/quit.cmd +6 -0
- data/test/data/quit.right +0 -0
- data/test/data/raise.cmd +11 -0
- data/test/data/raise.right +23 -0
- data/test/data/save.cmd +34 -0
- data/test/data/save.right +59 -0
- data/test/data/scope-var.cmd +42 -0
- data/test/data/scope-var.right +587 -0
- data/test/data/setshow.cmd +56 -0
- data/test/data/setshow.right +98 -0
- data/test/data/source.cmd +5 -0
- data/test/data/source.right +15 -0
- data/test/data/stepping.cmd +21 -0
- data/test/data/stepping.right +50 -0
- data/test/data/test-init-cygwin.right +7 -0
- data/test/data/test-init-osx.right +4 -0
- data/test/data/test-init.right +5 -0
- data/test/data/trace.right +14 -0
- data/test/dollar-0.rb +5 -0
- data/test/gcd-dbg-nox.rb +31 -0
- data/test/gcd-dbg.rb +30 -0
- data/test/gcd.rb +18 -0
- data/test/helper.rb +144 -0
- data/test/info-var-bug.rb +47 -0
- data/test/info-var-bug2.rb +2 -0
- data/test/jump.rb +14 -0
- data/test/jump2.rb +27 -0
- data/test/next.rb +18 -0
- data/test/null.rb +1 -0
- data/test/output.rb +2 -0
- data/test/pm-base.rb +22 -0
- data/test/pm-bug.rb +3 -0
- data/test/pm-catch.rb +12 -0
- data/test/pm-catch2.rb +27 -0
- data/test/pm-catch3.rb +47 -0
- data/test/pm.rb +11 -0
- data/test/raise.rb +3 -0
- data/test/rdebug-save.1 +7 -0
- data/test/runall +12 -0
- data/test/scope-var.rb +29 -0
- data/test/tdebug.rb +248 -0
- data/test/test-annotate.rb +25 -0
- data/test/test-break-bad.rb +37 -0
- data/test/test-breakpoints.rb +25 -0
- data/test/test-catch.rb +25 -0
- data/test/test-catch2.rb +25 -0
- data/test/test-catch3.rb +25 -0
- data/test/test-condition.rb +25 -0
- data/test/test-ctrl.rb +55 -0
- data/test/test-display.rb +26 -0
- data/test/test-dollar-0.rb +40 -0
- data/test/test-edit.rb +26 -0
- data/test/test-emacs-basic.rb +26 -0
- data/test/test-enable.rb +25 -0
- data/test/test-finish.rb +34 -0
- data/test/test-frame.rb +34 -0
- data/test/test-help.rb +60 -0
- data/test/test-hist.rb +68 -0
- data/test/test-info-thread.rb +32 -0
- data/test/test-info-var.rb +47 -0
- data/test/test-info.rb +26 -0
- data/test/test-init.rb +44 -0
- data/test/test-jump.rb +35 -0
- data/test/test-list.rb +25 -0
- data/test/test-method.rb +34 -0
- data/test/test-next.rb +25 -0
- data/test/test-output.rb +26 -0
- data/test/test-quit.rb +30 -0
- data/test/test-raise.rb +25 -0
- data/test/test-save.rb +31 -0
- data/test/test-scope-var.rb +25 -0
- data/test/test-setshow.rb +25 -0
- data/test/test-source.rb +25 -0
- data/test/test-stepping.rb +26 -0
- data/test/test-trace.rb +47 -0
- data/test/thread1.rb +26 -0
- data/test/trunc-call.rb +31 -0
- metadata +364 -0
@@ -0,0 +1,104 @@
|
|
1
|
+
;; -*- emacs-lisp -*-
|
2
|
+
;; This program has to be run from the directory it is currently in and
|
3
|
+
;; the rdebug code has to be in the parent directory
|
4
|
+
(load-file "./elk-test.el")
|
5
|
+
|
6
|
+
;; FIXME? Should we use "require 'rdebug" here.
|
7
|
+
;; Would have to prepend . to load-path.
|
8
|
+
(load-file "../rdebug.el")
|
9
|
+
(load-file "../rdebug-core.el")
|
10
|
+
|
11
|
+
;; Redefine functions to make them harmless for testing
|
12
|
+
(defun rdebug-process-annotation (name contents)
|
13
|
+
(message name)
|
14
|
+
)
|
15
|
+
|
16
|
+
(make-variable-buffer-local 'gud-rdebug-marker-acc)
|
17
|
+
|
18
|
+
(deftest "rdebug-get-script-name-test"
|
19
|
+
(assert-equal '("foo" nil) (rdebug-get-script-name '("rdebug" "foo")))
|
20
|
+
(assert-equal '("foo" nil) (rdebug-get-script-name '("rdebug" "-m" "foo")))
|
21
|
+
(assert-equal '("foo" t) (rdebug-get-script-name
|
22
|
+
'("rdebug" "--emacs" "3" "foo")))
|
23
|
+
(assert-equal '("foo" t) (rdebug-get-script-name
|
24
|
+
'("myrdebug" "--annotate=1" "foo")))
|
25
|
+
(assert-equal '("foo" t) (rdebug-get-script-name
|
26
|
+
'("ruby" "rdebug" "--annotate" "1" "foo")))
|
27
|
+
(assert-equal '("foo" nil) (rdebug-get-script-name
|
28
|
+
'("/usr/bin/ruby19" "rdebug" "--emacs-basic" "foo")))
|
29
|
+
(assert-equal '("foo" nil) (rdebug-get-script-name
|
30
|
+
'("rdbg.rb" "foo")))
|
31
|
+
(assert-equal '("rdbg.rb" nil) (rdebug-get-script-name
|
32
|
+
'("rdebug" "rdbg.rb" "foo")))
|
33
|
+
(assert-equal '("foo" t) (rdebug-get-script-name '("rdebug" "-A" "1" "foo")))
|
34
|
+
(assert-equal '("foo" nil)
|
35
|
+
(rdebug-get-script-name
|
36
|
+
'("rdebug" "--include" "me" "-n" "foo")))
|
37
|
+
(assert-equal '("foo" nil) (rdebug-get-script-name
|
38
|
+
'("rdebug" "--server" "-d" "--host"
|
39
|
+
"localhost" "foo" "-1")))
|
40
|
+
)
|
41
|
+
|
42
|
+
(deftest "rdebug-goto-entry-test"
|
43
|
+
(let ((buf (generate-new-buffer "testing")))
|
44
|
+
(save-excursion
|
45
|
+
(switch-to-buffer buf)
|
46
|
+
(insert "#0 at line /tmp/gcd.rb:4\n")
|
47
|
+
(goto-char (point-min))
|
48
|
+
(assert-equal t (rdebug-goto-entry-try "0"))
|
49
|
+
(assert-equal nil (rdebug-goto-entry-try "1"))
|
50
|
+
(insert " 1 y at gcd.rb:10\n")
|
51
|
+
(goto-char (point-min))
|
52
|
+
;; Don't know why this doesn't work.
|
53
|
+
;;(assert-equal t (rdebug-goto-entry-try "1"))
|
54
|
+
(insert "5: 1 + 2 = 3\n")
|
55
|
+
(goto-char (point-min))
|
56
|
+
(assert-equal t (rdebug-goto-entry-try "5"))
|
57
|
+
(goto-char (point-min))
|
58
|
+
(assert-equal nil (rdebug-goto-entry-try "3")))
|
59
|
+
(kill-buffer buf)))
|
60
|
+
|
61
|
+
(defun rdebug-test-call-entry-n (str)
|
62
|
+
"Call `rdebug-goto-entry-n', return the line we landed on."
|
63
|
+
(rdebug-goto-entry-n-internal str)
|
64
|
+
(beginning-of-line)
|
65
|
+
(count-lines (point-min) (point)))
|
66
|
+
|
67
|
+
;; The original implementation could not go to "10" if there was no "1" entry.
|
68
|
+
(deftest "rdebug-goto-entry-test-2"
|
69
|
+
(let ((buf (generate-new-buffer "testing")))
|
70
|
+
(save-excursion
|
71
|
+
(switch-to-buffer buf)
|
72
|
+
(insert "#0 at line /tmp/gcd.rb:4\n")
|
73
|
+
(insert "#2 at line /tmp/gcd.rb:44\n")
|
74
|
+
(insert "#13 at line /tmp/gcd.rb:444\n")
|
75
|
+
(goto-char (point-min))
|
76
|
+
(setq rdebug-goto-entry-acc "")
|
77
|
+
;; Goto "0"
|
78
|
+
(assert-equal 0 (rdebug-test-call-entry-n "0"))
|
79
|
+
;; Goto "2"
|
80
|
+
(assert-equal 1 (rdebug-test-call-entry-n "2"))
|
81
|
+
;; There is no "1" or "21" or "021", so stay.
|
82
|
+
(assert-equal 1 (rdebug-test-call-entry-n "1"))
|
83
|
+
;; Goto "13"
|
84
|
+
(assert-equal 2 (rdebug-test-call-entry-n "3"))
|
85
|
+
;; There is no "5", "35", or "135", so stay.
|
86
|
+
(assert-equal 2 (rdebug-test-call-entry-n "5"))
|
87
|
+
;; Goto "0"
|
88
|
+
(assert-equal 0 (rdebug-test-call-entry-n "0"))
|
89
|
+
;; Goto "2"
|
90
|
+
(assert-equal 1 (rdebug-test-call-entry-n "2")))
|
91
|
+
(kill-buffer buf)))
|
92
|
+
|
93
|
+
|
94
|
+
;; -------------------------------------------------------------------
|
95
|
+
;; Build and run the test suite.
|
96
|
+
;;
|
97
|
+
|
98
|
+
(build-suite "rdebug-suite"
|
99
|
+
"rdebug-get-script-name-test"
|
100
|
+
"rdebug-goto-entry-test"
|
101
|
+
"rdebug-goto-entry-test-2")
|
102
|
+
(run-elk-test "rdebug-suite"
|
103
|
+
"test things in rdebug-core.el")
|
104
|
+
|
@@ -0,0 +1,65 @@
|
|
1
|
+
;; -*- emacs-lisp -*-
|
2
|
+
;; This program has to be run from the directory it is currently in and
|
3
|
+
;; the rdebug code has to be in the parent directory
|
4
|
+
(load-file "./elk-test.el")
|
5
|
+
|
6
|
+
(setq load-path (cons ".." load-path))
|
7
|
+
(require 'rdebug-fns)
|
8
|
+
(require 'rdebug-locring)
|
9
|
+
(setq load-path (cdr load-path))
|
10
|
+
|
11
|
+
;; -------------------------------------------------------------------
|
12
|
+
|
13
|
+
(deftest "test-add-to-ring"
|
14
|
+
(let ((location-ring (make-ring 5)))
|
15
|
+
(assert-equal t (ring-empty-p location-ring))
|
16
|
+
(rdebug-locring-add 'first location-ring)
|
17
|
+
(assert-equal 'first (ring-ref location-ring 0))
|
18
|
+
(assert-equal 1 (ring-length location-ring))
|
19
|
+
;; Trying to add the same entry should not again.
|
20
|
+
(rdebug-locring-add 'first location-ring)
|
21
|
+
(assert-equal 1 (ring-length location-ring))
|
22
|
+
|
23
|
+
;; Second should go in as last item.
|
24
|
+
(rdebug-locring-add 'second location-ring)
|
25
|
+
(assert-equal 'second (ring-ref location-ring 1))
|
26
|
+
;; First item is still 0.
|
27
|
+
(assert-equal 'first (ring-ref location-ring 0))))
|
28
|
+
|
29
|
+
(deftest "test-chomp"
|
30
|
+
(assert-equal "" (chomp ""))
|
31
|
+
(assert-equal "hi" (chomp "hi"))
|
32
|
+
(assert-equal "hi" (chomp "hi\n"))
|
33
|
+
(assert-equal "hi\n" (chomp "hi\n\n"))
|
34
|
+
(assert-equal "hi" (chomp "hi\n\n" t)))
|
35
|
+
|
36
|
+
(deftest "test-set-frame-arrow"
|
37
|
+
(let ((rdebug-frames-current-frame-number 0))
|
38
|
+
(rdebug-set-frame-arrow (current-buffer))
|
39
|
+
(assert-equal '((overlay-arrow . right-triangle))
|
40
|
+
fringe-indicator-alist)
|
41
|
+
(setq rdebug-frames-current-frame-number 1)
|
42
|
+
(rdebug-set-frame-arrow (current-buffer))
|
43
|
+
(assert-equal '((overlay-arrow . hollow-right-triangle))
|
44
|
+
fringe-indicator-alist)))
|
45
|
+
|
46
|
+
(require 'shell)
|
47
|
+
(deftest "test-dead-process-p"
|
48
|
+
(assert-equal t (rdebug-dead-process-p))
|
49
|
+
(let ((gud-comint-buffer nil))
|
50
|
+
(assert-equal t (rdebug-dead-process-p))
|
51
|
+
(setq gud-comint-buffer (shell))
|
52
|
+
(assert-equal nil (rdebug-dead-process-p))))
|
53
|
+
|
54
|
+
;; -------------------------------------------------------------------
|
55
|
+
;; Build and run the test suite.
|
56
|
+
;;
|
57
|
+
|
58
|
+
(build-suite "rdebug-gud-suite"
|
59
|
+
"test-add-to-ring"
|
60
|
+
"test-chomp"
|
61
|
+
"test-dead-process-p"
|
62
|
+
"test-set-frame-arrow")
|
63
|
+
|
64
|
+
(run-elk-test "rdebug-gud-suite"
|
65
|
+
"test some rdebug-error code")
|
@@ -0,0 +1,62 @@
|
|
1
|
+
;; -*- emacs-lisp -*-
|
2
|
+
;; This program has to be run from the directory it is currently in and
|
3
|
+
;; the rdebug code has to be in the parent directory
|
4
|
+
(load-file "./elk-test.el")
|
5
|
+
|
6
|
+
;; FIXME? Should we use "require 'rdebug" here.
|
7
|
+
;; Would have to prepend . to load-path.
|
8
|
+
(load-file "../rdebug.el")
|
9
|
+
(load-file "../rdebug-regexp.el")
|
10
|
+
(load-file "../rdebug-frames.el")
|
11
|
+
|
12
|
+
(make-variable-buffer-local 'gud-rdebug-marker-acc)
|
13
|
+
|
14
|
+
(deftest "rdebug-stack-buffer-field-test"
|
15
|
+
(let ((buf (generate-new-buffer "testing")))
|
16
|
+
(save-excursion
|
17
|
+
(switch-to-buffer buf)
|
18
|
+
(insert
|
19
|
+
"--> #0 Object.gcd(a#Fixnum, b#Fixnum) at line /tmp/gcd.rb:4\n")
|
20
|
+
(insert
|
21
|
+
" at line /foo/bar/custom_require.rb:27\n")
|
22
|
+
|
23
|
+
(goto-char (point-min))
|
24
|
+
(let* ((b (line-beginning-position)) (e (line-end-position))
|
25
|
+
(s (buffer-substring b e))
|
26
|
+
(file nil) (line nil))
|
27
|
+
(assert-nonnil (string-match rdebug-stack-frame-regexp s))
|
28
|
+
(assert-equal "/tmp/gcd.rb" (rdebug-stack-buffer-field
|
29
|
+
s b
|
30
|
+
rdebug-stack-frame-file-group
|
31
|
+
font-lock-comment-face))
|
32
|
+
(assert-equal "4" (rdebug-stack-buffer-field
|
33
|
+
s b
|
34
|
+
rdebug-stack-frame-line-group
|
35
|
+
font-lock-constant-face))
|
36
|
+
(forward-line)
|
37
|
+
(setq b (line-beginning-position))
|
38
|
+
(setq e (line-end-position))
|
39
|
+
(setq s (buffer-substring b e))
|
40
|
+
(assert-nonnil (string-match rdebug-stack-frame-2nd-regexp s))
|
41
|
+
(assert-equal "/foo/bar/custom_require.rb"
|
42
|
+
(rdebug-stack-buffer-field
|
43
|
+
s b
|
44
|
+
rdebug-stack-frame-2nd-file-group
|
45
|
+
font-lock-comment-face))
|
46
|
+
(assert-equal "27" (rdebug-stack-buffer-field
|
47
|
+
s b
|
48
|
+
rdebug-stack-frame-2nd-line-group
|
49
|
+
font-lock-constant-face))
|
50
|
+
))
|
51
|
+
(kill-buffer buf)))
|
52
|
+
|
53
|
+
|
54
|
+
;; -------------------------------------------------------------------
|
55
|
+
;; Build and run the test suite.
|
56
|
+
;;
|
57
|
+
|
58
|
+
(build-suite "rdebug-suite"
|
59
|
+
"rdebug-stack-buffer-field-test")
|
60
|
+
(run-elk-test "rdebug-suite"
|
61
|
+
"test things in rdebug-frames.el")
|
62
|
+
|
@@ -0,0 +1,35 @@
|
|
1
|
+
;; -*- emacs-lisp -*-
|
2
|
+
;; This program has to be run from the directory it is currently in and
|
3
|
+
;; the rdebug code has to be in the parent directory
|
4
|
+
(load-file "./elk-test.el")
|
5
|
+
|
6
|
+
(setq load-path (cons ".." load-path))
|
7
|
+
(require 'rdebug-gud)
|
8
|
+
(setq load-path (cdr load-path))
|
9
|
+
|
10
|
+
(defun y-or-n-p (prompt)
|
11
|
+
"Replacement of y-or-n-p() for rdebug testing"
|
12
|
+
(assert-nil "y-or-n-p should not have been called"))
|
13
|
+
|
14
|
+
(defun error (msg)
|
15
|
+
"Replacement error() for rdebug testing"
|
16
|
+
(assert-nil "error should not have been called"))
|
17
|
+
|
18
|
+
;; -------------------------------------------------------------------
|
19
|
+
|
20
|
+
(deftest "test-rdebug-find-file"
|
21
|
+
;; Set to cause a warning in find-file-no-select and
|
22
|
+
;; check that it is ignored.
|
23
|
+
(let ((large-file-warning-threshold 1))
|
24
|
+
(gud-rdebug-find-file "elk-test.el")))
|
25
|
+
|
26
|
+
|
27
|
+
;; -------------------------------------------------------------------
|
28
|
+
;; Build and run the test suite.
|
29
|
+
;;
|
30
|
+
|
31
|
+
(build-suite "rdebug-gud-suite"
|
32
|
+
"test-rdebug-find-file")
|
33
|
+
|
34
|
+
(run-elk-test "rdebug-gud-suite"
|
35
|
+
"test some rdebug-gud code")
|
@@ -0,0 +1,58 @@
|
|
1
|
+
;; -*- emacs-lisp -*-
|
2
|
+
;; This program has to be run from the directory it is currently in and
|
3
|
+
;; the rdebug code has to be in the parent directory
|
4
|
+
(load-file "./elk-test.el")
|
5
|
+
|
6
|
+
;; -------------------------------------------------------------------
|
7
|
+
;; Check source code indentation
|
8
|
+
;;
|
9
|
+
|
10
|
+
(put 'rdebug-debug-enter 'lisp-indent-hook 1)
|
11
|
+
|
12
|
+
(defun rdebug-test-reindent-one-file (file)
|
13
|
+
(let ((buf (generate-new-buffer "testing"))
|
14
|
+
(res nil))
|
15
|
+
(save-excursion
|
16
|
+
(switch-to-buffer buf)
|
17
|
+
(insert-file file)
|
18
|
+
(emacs-lisp-mode)
|
19
|
+
(set-buffer-modified-p nil)
|
20
|
+
(undo-boundary)
|
21
|
+
(indent-region (point-min) (point-max))
|
22
|
+
(if (buffer-modified-p)
|
23
|
+
(setq res "Reindentation failed")))
|
24
|
+
(kill-buffer buf)
|
25
|
+
res))
|
26
|
+
|
27
|
+
(deftest "rdebug-indent-files"
|
28
|
+
(mapcar (lambda (lisp-file)
|
29
|
+
(message lisp-file)
|
30
|
+
(assert-nil (rdebug-test-reindent-one-file lisp-file)))
|
31
|
+
'("../rdebug.el"
|
32
|
+
"../rdebug-breaks.el"
|
33
|
+
"../rdebug-cmd.el"
|
34
|
+
"../rdebug-core.el"
|
35
|
+
"../rdebug-dbg.el"
|
36
|
+
"../rdebug-error.el"
|
37
|
+
"../rdebug-frames.el"
|
38
|
+
"../rdebug-fns.el"
|
39
|
+
"../rdebug-gud.el"
|
40
|
+
"../rdebug-help.el"
|
41
|
+
"../rdebug-info.el"
|
42
|
+
"../rdebug-layouts.el"
|
43
|
+
"../rdebug-output.el"
|
44
|
+
"../rdebug-regexp.el"
|
45
|
+
"../rdebug-secondary.el"
|
46
|
+
"../rdebug-source.el"
|
47
|
+
"../rdebug-track.el"
|
48
|
+
"../rdebug-varbuf.el"
|
49
|
+
"../rdebug-vars.el"
|
50
|
+
"../rdebug-watch.el"
|
51
|
+
"./test-cmd.el"
|
52
|
+
"./test-core.el"
|
53
|
+
"./test-indent.el"
|
54
|
+
"./test-regexp.el"
|
55
|
+
)))
|
56
|
+
|
57
|
+
(run-elk-test "rdebug-indent-files"
|
58
|
+
"test indentation of Lisp files")
|
@@ -0,0 +1,144 @@
|
|
1
|
+
;; -*- emacs-lisp -*-
|
2
|
+
;; This program has to be run from the directory it is currently in and
|
3
|
+
;; the rdebug code has to be in the parent directory
|
4
|
+
(load-file "./elk-test.el")
|
5
|
+
|
6
|
+
;; FIXME? Should we use "require 'rdebug" here.
|
7
|
+
;; Would have to prepend . to load-path.
|
8
|
+
(load-file "../rdebug.el")
|
9
|
+
(load-file "../rdebug-core.el")
|
10
|
+
|
11
|
+
(make-variable-buffer-local 'gud-rdebug-marker-acc)
|
12
|
+
|
13
|
+
(defun regexp-breakpoint-test (location-str pos-str enabled-str file-str line-str)
|
14
|
+
"Test to see that location-str parses rdebug-breakpoint-regexp properly"
|
15
|
+
(assert-equal 0 (string-match rdebug-breakpoint-regexp location-str))
|
16
|
+
(assert-equal pos-str
|
17
|
+
(substring location-str (match-beginning 1) (match-end 1)))
|
18
|
+
(assert-equal enabled-str
|
19
|
+
(substring location-str (match-beginning 2) (match-end 2)))
|
20
|
+
(assert-equal file-str
|
21
|
+
(substring location-str (match-beginning 3) (match-end 3)))
|
22
|
+
(assert-equal line-str
|
23
|
+
(substring location-str (match-beginning 4) (match-end 4)))
|
24
|
+
)
|
25
|
+
(deftest "rdebug-regexp-breakpoint-test"
|
26
|
+
|
27
|
+
(regexp-breakpoint-test
|
28
|
+
" 1 y at gcd.rb:6"
|
29
|
+
"1" "y" "gcd.rb" "6"
|
30
|
+
)
|
31
|
+
(regexp-breakpoint-test
|
32
|
+
" 1 y at gcd.rb:6 if 1 == a"
|
33
|
+
"1" "y" "gcd.rb" "6"
|
34
|
+
)
|
35
|
+
)
|
36
|
+
|
37
|
+
(defun regexp-file-test (location-str file-str)
|
38
|
+
"Test to see that location-str matches gud-rdebug-marker-regexp"
|
39
|
+
(assert-equal 0 (string-match gud-rdebug-marker-regexp location-str))
|
40
|
+
(assert-equal file-str
|
41
|
+
(substring location-str (match-beginning 1) (match-end 1)))
|
42
|
+
)
|
43
|
+
(deftest "rdebug-regexp-file-test"
|
44
|
+
|
45
|
+
(regexp-file-test
|
46
|
+
"\032\032./hanoi.rb:3\n"
|
47
|
+
"./hanoi.rb"
|
48
|
+
)
|
49
|
+
(regexp-file-test
|
50
|
+
"\032\032source ./hanoi.rb:3\n"
|
51
|
+
"./hanoi.rb"
|
52
|
+
)
|
53
|
+
(regexp-file-test
|
54
|
+
"\032\032C:/tmp/gcd.rb:29\n"
|
55
|
+
"C:/tmp/gcd.rb"
|
56
|
+
)
|
57
|
+
(regexp-file-test
|
58
|
+
"\032\032source \\sources\\capfilterscanner\\capanalyzer.rb:3: <module>\n"
|
59
|
+
"\\sources\\capfilterscanner\\capanalyzer.rb"
|
60
|
+
)
|
61
|
+
)
|
62
|
+
|
63
|
+
(deftest "rdebug-regexp-marker-filter-test"
|
64
|
+
(assert-equal "Testing 1 2 3" (gud-rdebug-marker-filter "Testing 1 2 3"))
|
65
|
+
(assert-equal "ABC" (gud-rdebug-marker-filter
|
66
|
+
"\
|
67
|
+
breakpoints
|
68
|
+
No breakpoints
|
69
|
+
|
70
|
+
ABC")))
|
71
|
+
|
72
|
+
(defun regexp-stack-test (location-str pos-str file-str line-str)
|
73
|
+
"Test to see that location-str parses rdebug-stack-frame-regexp properly"
|
74
|
+
(assert-equal 0 (string-match rdebug-stack-frame-regexp location-str))
|
75
|
+
(assert-equal pos-str
|
76
|
+
(substring location-str (match-beginning 2) (match-end 2)))
|
77
|
+
(assert-equal file-str
|
78
|
+
(substring location-str (match-beginning 4) (match-end 4)))
|
79
|
+
(assert-equal line-str
|
80
|
+
(substring location-str (match-beginning 5) (match-end 5)))
|
81
|
+
)
|
82
|
+
(deftest "rdebug-regexp-stack-test"
|
83
|
+
|
84
|
+
(regexp-stack-test
|
85
|
+
"--> #0 at line /home/rocky/ruby/gcd.rb:18"
|
86
|
+
"0" "/home/rocky/ruby/gcd.rb" "18"
|
87
|
+
)
|
88
|
+
)
|
89
|
+
|
90
|
+
(defun regexp-traceback-test (location-str file-str line-str)
|
91
|
+
"Test to see that location-str matches position-regexp-file-test with the correct
|
92
|
+
file and line submatches."
|
93
|
+
(assert-equal 0 (string-match rdebug-traceback-line-re location-str))
|
94
|
+
(assert-equal file-str (match-string 1 location-str))
|
95
|
+
(assert-equal line-str (match-string 2 location-str))
|
96
|
+
)
|
97
|
+
|
98
|
+
(deftest "rdebug-regexp-traceback-test"
|
99
|
+
|
100
|
+
(regexp-traceback-test
|
101
|
+
" from /home/rocky/ruby/gcd.rb:15:in `gcd'"
|
102
|
+
"/home/rocky/ruby/gcd.rb" "15"
|
103
|
+
)
|
104
|
+
(regexp-traceback-test
|
105
|
+
" from /home/rocky/ruby/gcd.rb:19"
|
106
|
+
"/home/rocky/ruby/gcd.rb" "19"
|
107
|
+
)
|
108
|
+
)
|
109
|
+
|
110
|
+
(defun regexp-unittest-traceback-test (location-str file-str line-str)
|
111
|
+
"Test to see that location-str matches position-regexp-file-test with the correct
|
112
|
+
file and line submatches."
|
113
|
+
(assert-equal 0 (string-match rdebug-dollarbang-traceback-line-re
|
114
|
+
location-str))
|
115
|
+
(assert-equal file-str (match-string 1 location-str))
|
116
|
+
(assert-equal line-str (match-string 2 location-str))
|
117
|
+
)
|
118
|
+
|
119
|
+
(deftest "rdebug-regexp-unittest-traceback-test"
|
120
|
+
|
121
|
+
(regexp-unittest-traceback-test
|
122
|
+
" [test-frame.rb:26:in `test_basic'"
|
123
|
+
"test-frame.rb" "26"
|
124
|
+
)
|
125
|
+
(regexp-unittest-traceback-test
|
126
|
+
" test-frame.rb:22:in `test_basic']:"
|
127
|
+
"test-frame.rb" "22"
|
128
|
+
)
|
129
|
+
)
|
130
|
+
|
131
|
+
;; -------------------------------------------------------------------
|
132
|
+
;; Build and run the test suite.
|
133
|
+
;;
|
134
|
+
|
135
|
+
(build-suite "rdebug-suite"
|
136
|
+
"rdebug-regexp-breakpoint-test"
|
137
|
+
"rdebug-regexp-file-test"
|
138
|
+
"rdebug-regexp-marker-filter-test"
|
139
|
+
"rdebug-regexp-stack-test"
|
140
|
+
"rdebug-regexp-traceback-test"
|
141
|
+
"rdebug-regexp-unittest-traceback-test")
|
142
|
+
|
143
|
+
(run-elk-test "rdebug-suite"
|
144
|
+
"test regular expressions used in tracking lines")
|