debugger2 1.0.0.beta1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (183) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +12 -0
  3. data/.travis.yml +3 -0
  4. data/AUTHORS +10 -0
  5. data/CHANGELOG.md +65 -0
  6. data/CONTRIBUTING.md +1 -0
  7. data/Gemfile +3 -0
  8. data/LICENSE +23 -0
  9. data/OLDER_CHANGELOG +334 -0
  10. data/OLD_CHANGELOG +5655 -0
  11. data/OLD_README +122 -0
  12. data/README.md +108 -0
  13. data/Rakefile +78 -0
  14. data/bin/rdebug +397 -0
  15. data/debugger2.gemspec +29 -0
  16. data/doc/.cvsignore +42 -0
  17. data/doc/Makefile.am +63 -0
  18. data/doc/emacs-notes.txt +38 -0
  19. data/doc/hanoi.rb +35 -0
  20. data/doc/primes.rb +28 -0
  21. data/doc/rdebug-emacs.texi +1030 -0
  22. data/doc/ruby-debug.texi +3791 -0
  23. data/doc/test-tri2.rb +18 -0
  24. data/doc/tri3.rb +8 -0
  25. data/doc/triangle.rb +12 -0
  26. data/emacs/Makefile.am +130 -0
  27. data/emacs/rdebug-annotate.el +385 -0
  28. data/emacs/rdebug-breaks.el +407 -0
  29. data/emacs/rdebug-cmd.el +92 -0
  30. data/emacs/rdebug-core.el +502 -0
  31. data/emacs/rdebug-dbg.el +62 -0
  32. data/emacs/rdebug-error.el +79 -0
  33. data/emacs/rdebug-fns.el +111 -0
  34. data/emacs/rdebug-frames.el +230 -0
  35. data/emacs/rdebug-gud.el +242 -0
  36. data/emacs/rdebug-help.el +104 -0
  37. data/emacs/rdebug-info.el +83 -0
  38. data/emacs/rdebug-layouts.el +180 -0
  39. data/emacs/rdebug-locring.el +118 -0
  40. data/emacs/rdebug-output.el +106 -0
  41. data/emacs/rdebug-regexp.el +118 -0
  42. data/emacs/rdebug-secondary.el +260 -0
  43. data/emacs/rdebug-shortkey.el +175 -0
  44. data/emacs/rdebug-source.el +568 -0
  45. data/emacs/rdebug-track.el +392 -0
  46. data/emacs/rdebug-varbuf.el +150 -0
  47. data/emacs/rdebug-vars.el +125 -0
  48. data/emacs/rdebug-watch.el +132 -0
  49. data/emacs/rdebug.el +326 -0
  50. data/emacs/test/elk-test.el +242 -0
  51. data/emacs/test/test-annotate.el +103 -0
  52. data/emacs/test/test-cmd.el +116 -0
  53. data/emacs/test/test-core.el +104 -0
  54. data/emacs/test/test-fns.el +65 -0
  55. data/emacs/test/test-frames.el +62 -0
  56. data/emacs/test/test-gud.el +35 -0
  57. data/emacs/test/test-indent.el +58 -0
  58. data/emacs/test/test-regexp.el +144 -0
  59. data/emacs/test/test-shortkey.el +61 -0
  60. data/ext/ruby_debug/breakpoint.c +630 -0
  61. data/ext/ruby_debug/extconf.rb +11 -0
  62. data/ext/ruby_debug/ruby_debug.c +2203 -0
  63. data/ext/ruby_debug/ruby_debug.h +151 -0
  64. data/lib/debugger.rb +5 -0
  65. data/lib/debugger/version.rb +5 -0
  66. data/lib/debugger2.rb +6 -0
  67. data/lib/ruby-debug-base.rb +307 -0
  68. data/lib/ruby-debug.rb +176 -0
  69. data/lib/ruby-debug/command.rb +227 -0
  70. data/lib/ruby-debug/commands/breakpoints.rb +153 -0
  71. data/lib/ruby-debug/commands/catchpoint.rb +55 -0
  72. data/lib/ruby-debug/commands/condition.rb +49 -0
  73. data/lib/ruby-debug/commands/continue.rb +38 -0
  74. data/lib/ruby-debug/commands/control.rb +107 -0
  75. data/lib/ruby-debug/commands/display.rb +120 -0
  76. data/lib/ruby-debug/commands/edit.rb +48 -0
  77. data/lib/ruby-debug/commands/enable.rb +202 -0
  78. data/lib/ruby-debug/commands/eval.rb +176 -0
  79. data/lib/ruby-debug/commands/finish.rb +42 -0
  80. data/lib/ruby-debug/commands/frame.rb +301 -0
  81. data/lib/ruby-debug/commands/help.rb +56 -0
  82. data/lib/ruby-debug/commands/info.rb +467 -0
  83. data/lib/ruby-debug/commands/irb.rb +123 -0
  84. data/lib/ruby-debug/commands/jump.rb +66 -0
  85. data/lib/ruby-debug/commands/kill.rb +51 -0
  86. data/lib/ruby-debug/commands/list.rb +94 -0
  87. data/lib/ruby-debug/commands/method.rb +84 -0
  88. data/lib/ruby-debug/commands/quit.rb +39 -0
  89. data/lib/ruby-debug/commands/reload.rb +40 -0
  90. data/lib/ruby-debug/commands/save.rb +90 -0
  91. data/lib/ruby-debug/commands/set.rb +223 -0
  92. data/lib/ruby-debug/commands/show.rb +247 -0
  93. data/lib/ruby-debug/commands/skip.rb +35 -0
  94. data/lib/ruby-debug/commands/source.rb +36 -0
  95. data/lib/ruby-debug/commands/stepping.rb +81 -0
  96. data/lib/ruby-debug/commands/threads.rb +189 -0
  97. data/lib/ruby-debug/commands/tmate.rb +36 -0
  98. data/lib/ruby-debug/commands/trace.rb +57 -0
  99. data/lib/ruby-debug/commands/variables.rb +199 -0
  100. data/lib/ruby-debug/debugger.rb +5 -0
  101. data/lib/ruby-debug/helper.rb +69 -0
  102. data/lib/ruby-debug/interface.rb +232 -0
  103. data/lib/ruby-debug/processor.rb +474 -0
  104. data/man/rdebug.1 +241 -0
  105. data/old_scripts/Makefile.am +14 -0
  106. data/old_scripts/README.md +2 -0
  107. data/old_scripts/autogen.sh +4 -0
  108. data/old_scripts/configure.ac +12 -0
  109. data/old_scripts/rdbg.rb +33 -0
  110. data/old_scripts/runner.sh +7 -0
  111. data/old_scripts/svn2cl_usermap +3 -0
  112. data/test/.cvsignore +1 -0
  113. data/test/breakpoints_test.rb +366 -0
  114. data/test/conditions_test.rb +77 -0
  115. data/test/continue_test.rb +28 -0
  116. data/test/display_test.rb +143 -0
  117. data/test/edit_test.rb +55 -0
  118. data/test/eval_test.rb +94 -0
  119. data/test/examples/breakpoint1.rb +15 -0
  120. data/test/examples/breakpoint2.rb +7 -0
  121. data/test/examples/conditions.rb +4 -0
  122. data/test/examples/continue.rb +4 -0
  123. data/test/examples/display.rb +5 -0
  124. data/test/examples/edit.rb +3 -0
  125. data/test/examples/edit2.rb +3 -0
  126. data/test/examples/eval.rb +4 -0
  127. data/test/examples/finish.rb +20 -0
  128. data/test/examples/frame.rb +31 -0
  129. data/test/examples/help.rb +2 -0
  130. data/test/examples/info.rb +48 -0
  131. data/test/examples/info2.rb +3 -0
  132. data/test/examples/irb.rb +6 -0
  133. data/test/examples/jump.rb +14 -0
  134. data/test/examples/kill.rb +2 -0
  135. data/test/examples/list.rb +12 -0
  136. data/test/examples/method.rb +15 -0
  137. data/test/examples/post_mortem.rb +19 -0
  138. data/test/examples/quit.rb +2 -0
  139. data/test/examples/reload.rb +6 -0
  140. data/test/examples/restart.rb +6 -0
  141. data/test/examples/save.rb +3 -0
  142. data/test/examples/set.rb +3 -0
  143. data/test/examples/set_annotate.rb +12 -0
  144. data/test/examples/settings.rb +1 -0
  145. data/test/examples/show.rb +2 -0
  146. data/test/examples/source.rb +3 -0
  147. data/test/examples/stepping.rb +21 -0
  148. data/test/examples/thread.rb +32 -0
  149. data/test/examples/tmate.rb +10 -0
  150. data/test/examples/trace.rb +7 -0
  151. data/test/examples/trace_threads.rb +20 -0
  152. data/test/examples/variables.rb +26 -0
  153. data/test/finish_test.rb +49 -0
  154. data/test/frame_test.rb +140 -0
  155. data/test/help_test.rb +51 -0
  156. data/test/info_test.rb +326 -0
  157. data/test/irb_test.rb +82 -0
  158. data/test/jump_test.rb +70 -0
  159. data/test/kill_test.rb +49 -0
  160. data/test/list_test.rb +147 -0
  161. data/test/method_test.rb +72 -0
  162. data/test/post_mortem_test.rb +25 -0
  163. data/test/quit_test.rb +56 -0
  164. data/test/reload_test.rb +47 -0
  165. data/test/restart_test.rb +145 -0
  166. data/test/save_test.rb +94 -0
  167. data/test/set_test.rb +183 -0
  168. data/test/show_test.rb +294 -0
  169. data/test/source_test.rb +46 -0
  170. data/test/stepping_test.rb +122 -0
  171. data/test/support/breakpoint.rb +12 -0
  172. data/test/support/context.rb +14 -0
  173. data/test/support/matchers.rb +67 -0
  174. data/test/support/mocha_extensions.rb +71 -0
  175. data/test/support/processor.rb +7 -0
  176. data/test/support/test_dsl.rb +206 -0
  177. data/test/support/test_interface.rb +66 -0
  178. data/test/test_helper.rb +9 -0
  179. data/test/thread_test.rb +124 -0
  180. data/test/tmate_test.rb +45 -0
  181. data/test/trace_test.rb +156 -0
  182. data/test/variables_test.rb +116 -0
  183. metadata +319 -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")