Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

DRY code. Make "make distcheck" work.

  • Loading branch information...
commit 593dd3e25c3086c6d856884f1da95bc7f7b59bb2 1 parent 53acebf
@rocky authored
View
4 Makefile.am
@@ -1,4 +1,4 @@
-SUBDIRS = dbgr
+SUBDIRS = dbgr test
lispdir = @lispdir@
lisp_files := $(wildcard dbgr.el)
@@ -6,7 +6,7 @@ lisp_LISP = $(lisp_files)
include common.mk
-EXTRA_DIST=common.mk README.textile
+EXTRA_DIST=common.mk README.textile dbgr.el
if MAINTAINER_MODE
View
2  dbgr/debugger/Makefile.am
@@ -4,5 +4,3 @@ EXTRA_DIST = common.mk
.PHONY: check all
-check:
- $(MAKE) -C $(top_srcdir)/test $@
View
6 test/regexp-helper.el
@@ -5,9 +5,15 @@
)
(defun loc-match(text var)
+ "Match TEXT against regexp field VAR"
(string-match (dbgr-loc-pat-regexp var) text)
)
+(defun cmdbuf-loc-match(text dbgr)
+ "Match TEXT against cmdbuf-info-loc field VAR"
+ (string-match (dbgr-cmdbuf-info-loc-regexp dbgr) text)
+)
+
(defun prompt-match(prompt-str &optional num-str fmt-str)
(unless fmt-str (setq fmt-str "debugger prompt %s"))
(assert-equal 0 (string-match (dbgr-loc-pat-regexp prompt-pat)
View
18 test/test-loc-regexp-trepan.el
@@ -1,6 +1,7 @@
(require 'test-simple)
(load-file "../dbgr/common/buffer/command.el")
(load-file "../dbgr/debugger/trepan/init.el")
+(load-file "./regexp-helper.el")
(test-simple-start)
@@ -17,16 +18,11 @@
:line-group (dbgr-loc-pat-line-group loc-pat)))
-(defun loc-match(text)
- (string-match (dbgr-cmdbuf-info-loc-regexp dbgr) text)
-)
-
-
(setq text "-- (/usr/local/bin/irb:9 @2)")
-(assert-t (numberp (loc-match text)) "basic location")
+(assert-t (numberp (cmdbuf-loc-match text dbgr)) "basic location")
(note "extract file name")
-(assert-equal 0 (loc-match text))
+(assert-equal 0 (cmdbuf-loc-match text dbgr))
(assert-equal "/usr/local/bin/irb"
(match-string (dbgr-cmdbuf-info-file-group dbgr)
text))
@@ -37,9 +33,9 @@
text) "extract line number")
(setq text "-> (<internal:lib/rubygems/custom_require>:28 remapped /usr/lib/ruby/gems/1.9.1/gems/data/custom_require.rb:28 @2)")
-(assert-t (numberp (loc-match text)) "remapped location")
+(assert-t (numberp (cmdbuf-loc-match text dbgr)) "remapped location")
-(assert-equal 0 (loc-match text))
+(assert-equal 0 (cmdbuf-loc-match text dbgr))
(assert-equal "/usr/lib/ruby/gems/1.9.1/gems/data/custom_require.rb"
(match-string (dbgr-cmdbuf-info-file-group dbgr)
text) "extract remapped file name")
@@ -50,9 +46,9 @@
text) "extract remapped line number")
(setq text "C> (/tmp/c-func.rb:2)")
-(assert-t (numberp (loc-match text)) "basic location for C fn")
+(assert-t (numberp (cmdbuf-loc-match text dbgr)) "basic location for C fn")
-(assert-equal 0 (loc-match text))
+(assert-equal 0 (cmdbuf-loc-match text dbgr))
(assert-equal "/tmp/c-func.rb"
(match-string (dbgr-cmdbuf-info-file-group dbgr)
text) "extract file name for C fn")
View
9 test/test-loc-regexp-trepanx.el
@@ -1,6 +1,7 @@
(require 'test-simple)
(load-file "../dbgr/common/buffer/command.el")
(load-file "../dbgr/debugger/trepanx/init.el")
+(load-file "./regexp-helper.el")
(test-simple-start)
@@ -18,20 +19,16 @@
:line-group (dbgr-loc-pat-line-group loc-pat)))
-(defun loc-match(text)
- (string-match (dbgr-cmdbuf-info-loc-regexp dbgr) text)
-)
-
(defun xagent-match(text)
(string-match (dbgr-loc-pat-regexp xagent-pat) text)
)
(setq text "-- (../rbx-trepanning/tmp/rbxtest.rb:7 @5)")
-(assert-t (numberp (loc-match text)) "basic location")
+(assert-t (numberp (cmdbuf-loc-match text dbgr)) "basic location")
(note "extract file name")
(setq text "-- (../rbx-trepanning/tmp/rbxtest.rb:7 @5)")
-(assert-equal 0 (loc-match text))
+(assert-equal 0 (cmdbuf-loc-match text dbgr))
(assert-equal "../rbx-trepanning/tmp/rbxtest.rb"
(match-string (dbgr-cmdbuf-info-file-group dbgr)
text))
View
4 test/test-regexp-bashdb.el
@@ -4,9 +4,9 @@
(test-simple-start)
-(setq prompt-pat (gethash "prompt" dbgr-bashdb-pat-hash))
-
(note "bashdb prompt matching")
+(set (make-local-variable 'prompt-pat)
+ (gethash "prompt" dbgr-bashdb-pat-hash))
(prompt-match "bashdb<10> " "10")
(prompt-match "bashdb<(5)> " "5" "subshell prompt %s")
(prompt-match "bashdb<<1>> " "1" "nested debug prompt %s")
View
12 test/test-regexp-gdb.el
@@ -1,6 +1,7 @@
(require 'test-simple)
(load-file "../dbgr/common/buffer/command.el")
(load-file "../dbgr/debugger/gdb/init.el")
+(load-file "./regexp-helper.el")
(test-simple-start)
@@ -22,11 +23,7 @@
(setq text "/home/rocky/c/ctest.c:80:2000:beg:0x8048748>")
(note "traceback location matching")
-(defun loc-match(text)
- (string-match (dbgr-cmdbuf-info-loc-regexp dbgr) text)
- )
-
-(assert-t (numberp (loc-match text)) "basic location")
+(assert-t (numberp (cmdbuf-loc-match text dbgr)) "basic location")
(assert-equal "/home/rocky/c/ctest.c"
(match-string (dbgr-cmdbuf-info-file-group dbgr)
text) "extract file name")
@@ -93,5 +90,10 @@
(match-beginning line-group)
(match-end line-group)))
+(note "prompt")
+(set (make-local-variable 'prompt-pat)
+ (gethash "prompt" dbgr-gdb-pat-hash))
+(prompt-match "(gdb) ")
+
(end-tests)
View
17 test/test-regexp-perldb.el
@@ -9,8 +9,10 @@
; We customize this for this debugger.
; FIXME: encapsulate this.
(setq dbg-name "perldb")
-(setq loc-pat (gethash "loc" (gethash dbg-name dbgr-pat-hash)))
-(setq prompt-pat (gethash "prompt" dbgr-perldb-pat-hash))
+(set (make-local-variable 'loc-pat)
+ (gethash "loc" (gethash dbg-name dbgr-pat-hash)))
+(set (make-local-variable 'prompt-pat)
+ (gethash "prompt" dbgr-perldb-pat-hash))
(setq dbgr (make-dbgr-cmdbuf-info
:debugger-name dbg-name
@@ -18,22 +20,17 @@
:file-group (dbgr-loc-pat-file-group loc-pat)
:line-group (dbgr-loc-pat-line-group loc-pat)))
-
(note "prompt")
(prompt-match " DB<2> " "2")
-(prompt-match "[pid=6489->6502] DB<1> " "1")
+(prompt-match "[pid=6489->6502] DB<1> " "1")
(assert-equal 0 (string-match dbgr-perl-ignore-file-re
"(eval 1006)[../example/eval.pl:5]")
"perldb file ignore matching")
-(defun loc-match(text)
- (string-match (dbgr-cmdbuf-info-loc-regexp dbgr) text)
- )
-
(setq text "main::(/usr/bin/latex2html:102):")
-(assert-t (numberp (loc-match text)) "basic location")
+(assert-t (numberp (cmdbuf-loc-match text dbgr)) "basic location")
(assert-equal "/usr/bin/latex2html"
(match-string (dbgr-cmdbuf-info-file-group dbgr) text)
"extract file name")
@@ -44,7 +41,7 @@
(note "location for with CODE in it")
(setq text "main::CODE(0x9407ac8)(l2hconf.pm:6):")
-(assert-t (numberp (loc-match text)))
+(assert-t (numberp (cmdbuf-loc-match text dbgr)))
(assert-equal "l2hconf.pm"
(match-string (dbgr-cmdbuf-info-file-group dbgr)
text))
View
5 test/test-regexp-rdebug.el
@@ -33,4 +33,9 @@
text) "extract breakpoint line number")
)
+(note "prompt")
+(set (make-local-variable 'prompt-pat)
+ (gethash "prompt" dbgr-rdebug-pat-hash))
+(prompt-match "(rdb:1) ")
+
(end-tests)
View
2  test/test-regexp-remake.el
@@ -11,7 +11,7 @@
(note "remake prompt")
(prompt-match "remake<10> " "10")
-(prompt-match "remake<<1>> " "1")
+(prompt-match "remake<<1>> " "1" "recursive remake %s")
(note "remake debugger-backtrace")
(setq s1
Please sign in to comment.
Something went wrong with that request. Please try again.