emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] master 7e1e1b0 25/56: Merge pull request #162 from realgud/column


From: Rocky Bernstein
Subject: [elpa] master 7e1e1b0 25/56: Merge pull request #162 from realgud/column-offsets
Date: Sat, 27 May 2017 05:02:32 -0400 (EDT)

branch: master
commit 7e1e1b08ada9be8715d51581bc3764f75b2761df
Merge: bbdeb4e 2ea1709
Author: R. Bernstein <address@hidden>
Commit: GitHub <address@hidden>

    Merge pull request #162 from realgud/column-offsets
    
    Column offsets
---
 Makefile.am                        |  3 +++
 realgud/common/buffer/backtrace.el |  2 +-
 realgud/common/buffer/command.el   | 14 +++++++---
 realgud/common/file.el             | 15 ++++++-----
 realgud/common/fringe.el           |  7 ++---
 realgud/common/regexp.el           |  4 +--
 realgud/common/track.el            | 52 ++++++++++++++++++++++++++------------
 realgud/debugger/gdb/init.el       |  2 +-
 realgud/debugger/gub/init.el       |  2 +-
 realgud/debugger/jdb/core.el       |  6 ++---
 realgud/debugger/nodejs/init.el    |  2 +-
 realgud/debugger/trepan/core.el    |  4 +--
 realgud/debugger/trepan2/core.el   |  4 +--
 realgud/debugger/trepanjs/init.el  |  4 +--
 realgud/lang/js.el                 |  2 +-
 realgud/lang/python.el             |  5 ++--
 test/test-file.el                  |  4 +--
 test/test-loc-regexp-nodejs.el     |  4 +--
 test/test-regexp-gub.el            |  6 +++--
 test/test-regexp-python.el         |  4 +--
 test/test-regexp-rdebug.el         |  4 +++
 test/test-regexp-trepan.el         | 49 ++++++++++++++++++++++-------------
 test/test-track.el                 | 42 ++++++++++++++++++++++--------
 23 files changed, 159 insertions(+), 82 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index f525b99..5188ce8 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1 +1,4 @@
 SUBDIRS = realgud
+
+check check-short:
+       $(MAKE) -C test $@
diff --git a/realgud/common/buffer/backtrace.el 
b/realgud/common/buffer/backtrace.el
index 816ffdb..b2ffc91 100644
--- a/realgud/common/buffer/backtrace.el
+++ b/realgud/common/buffer/backtrace.el
@@ -461,7 +461,7 @@ filename, line number, whether the frame is selected as 
text properties."
          ))
 
        (when (and (stringp filename) (numberp line-num))
-         (let ((loc (realgud:file-loc-from-line filename line-num cmdbuf)))
+         (let ((loc (realgud:file-loc-from-line filename line-num nil cmdbuf)))
            (put-text-property (match-beginning 0) (match-end 0)
                               'loc loc string)
            ))
diff --git a/realgud/common/buffer/command.el b/realgud/common/buffer/command.el
index bd8aaca..c66dc9b 100644
--- a/realgud/common/buffer/command.el
+++ b/realgud/common/buffer/command.el
@@ -93,11 +93,17 @@
 
   ;; FIXME: REMOVE THIS and use regexp-hash
   loc-regexp   ;; Location regular expression string
-  file-group
-  line-group
+  file-group   ;; file path
+  line-group   ;; line number
+  ;; FIXME: remove alt- things
+  ;; They are here because sometimes we can't get a single regexp
+  ;; pattern to have all regexp file paths or line numbers appear at the
+  ;; same pattern group (e.g. in the first position)
   alt-file-group
   alt-line-group
-  text-group
+  column-group  ;; Column within a line
+  char-offset-group ;; char offset from begging of file
+  text-group  ;; Matching text
   ignore-file-re
 
   loc-hist     ;; ring of locations seen in the course of execution
@@ -331,6 +337,8 @@ values set in the debugger's init.el."
             :line-group (realgud-sget 'loc-pat 'line-group)
             :alt-file-group (realgud-sget 'loc-pat 'alt-file-group)
             :alt-line-group (realgud-sget 'loc-pat 'alt-line-group)
+            :column-group (realgud-sget 'loc-pat 'column-group)
+            :char-offset-group (realgud-sget 'loc-pat 'column-group)
             :text-group (realgud-sget 'loc-pat 'text-group)
             :ignore-file-re (realgud-sget 'loc-pat 'ignore-file-re)
             :loc-hist (make-realgud-loc-hist)
diff --git a/realgud/common/file.el b/realgud/common/file.el
index cd27057..ad4d022 100644
--- a/realgud/common/file.el
+++ b/realgud/common/file.el
@@ -55,9 +55,8 @@ at LINE-NUMBER or nil if it is not there"
                 (current-column))))))
     (error nil)))
 
-;; FIXME: should allow column number to be passed in.
 (defun realgud:file-loc-from-line(filename line-number
-                                          &optional cmd-marker source-text 
bp-num
+                                          &optional column cmd-marker 
source-text bp-num
                                           ;; FIXME: remove ignore-file-re and 
cover with
                                           ;; find-file-fn.
                                           ignore-file-re find-file-fn 
directory)
@@ -110,9 +109,11 @@ problem as best as we can determine."
                    (if (setq line-count (realgud:file-line-count filename))
                        (if (> line-count line-number)
                            (let* ((column-number
-                                   (realgud:file-column-from-string filename
-                                                                   line-number
-                                                                   
source-text))
+                                   (or column
+                                       (realgud:file-column-from-string 
filename
+                                                                        
line-number
+                                                                        
source-text)
+                                       1))
                                   (source-buffer (find-file-noselect filename))
                                   (source-mark))
 
@@ -120,8 +121,10 @@ problem as best as we can determine."
                              ;; doing something other than validation?
                              (with-current-buffer source-buffer
                                (goto-char (point-min))
-                               ;; FIXME also allow column number and byte 
offset
+                               ;; FIXME allow for byte offset
                                (forward-line (1- line-number))
+                               (if (> column-number 0)
+                                   (move-to-column (1- column-number)))
                                (make-realgud-loc
                                      :num           bp-num
                                      :cmd-marker    cmd-marker
diff --git a/realgud/common/fringe.el b/realgud/common/fringe.el
index c50153b..042424a 100644
--- a/realgud/common/fringe.el
+++ b/realgud/common/fringe.el
@@ -131,7 +131,9 @@ for example to indicate a debugger position."
                ;; We need to ignore field boundaries, so we use
                ;; forward-line rather than beginning-of-line.
                (forward-line 0)
-               (set overlay-arrow (point-marker)))))))))
+               (setq overlay-arrow-position (point-marker))
+               (goto-char position)
+               )))))))
 
 (defun realgud-fringe-history-set (loc-hist &optional do-cmdbuf?)
   "Set arrows on the last positions we have stopped on."
@@ -158,8 +160,7 @@ for example to indicate a debugger position."
     (when loc1
       (realgud-fringe-set-arrow 'realgud-overlay-arrow1 mark1)
       (when (and do-cmdbuf? cmd-mark1)
-         (realgud-fringe-set-arrow 'realgud-overlay-arrow1 cmd-mark1)
-         (goto-char (marker-position cmd-mark1)))
+         (realgud-fringe-set-arrow 'realgud-overlay-arrow1 cmd-mark1))
       )
     ))
 
diff --git a/realgud/common/regexp.el b/realgud/common/regexp.el
index e21de25..1c6ff5b 100644
--- a/realgud/common/regexp.el
+++ b/realgud/common/regexp.el
@@ -41,13 +41,13 @@ output by a debugger inside a process shell"
                        ;; file position as in Perl locations.
   (regexp)             ;; a stack position, or thread number.
   (file-group)         ;; Filename position in struct
-  (line-group)         ;; Line number position in struct
+  (line-group)         ;; Line number position in struct. First line is 1
   (alt-file-group)     ;; Used when regexp is too complicated and use \|
                        ;; e.g. perldb file loc regexps
   (alt-line-group)     ;; ditto
+  (column-group)       ;; Column position in struct. First position is 1
   (char-offset-group)  ;; Character offset position in struct
   (instruction-address-group)
-  (column-group)
   (ignore-file-re)     ;; Some debuggers create pseudo files in eval strings
                        ;; for example "(eval)" in Ruby and Perl
   (text-group)         ;; Some source text that should found at position
diff --git a/realgud/common/track.el b/realgud/common/track.el
index f26a0ed..070d9b0 100644
--- a/realgud/common/track.el
+++ b/realgud/common/track.el
@@ -154,7 +154,17 @@ finding a new location/s.  The parameter TEXT appears 
because it
 is part of the comint-output-filter-functions API. Instead we use
 marks set in buffer-local variables to extract text"
   (if (and realgud-track-mode (realgud-cmdbuf? (current-buffer)))
-      (realgud-track-loc text (point-marker))
+      (let ((loc-regexp (realgud-sget 'cmdbuf-info 'loc-regexp))
+           (file-group (realgud-sget 'cmdbuf-info 'file-group))
+           (line-group (realgud-sget 'cmdbuf-info 'line-group))
+           (column-group (realgud-sget 'cmdbuf-info 'column-group))
+           (alt-file-group (realgud-sget 'cmdbuf-info 'alt-file-group))
+           (alt-line-group (realgud-sget 'cmdbuf-info 'alt-line-group))
+           (text-group (realgud-sget 'cmdbuf-info 'text-group))
+           )
+       (realgud-track-loc text (point-marker) loc-regexp file-group
+                          line-group column-group text-group
+                          ))
     ))
 
 (defun realgud:track-complain-if-not-in-cmd-buffer (&optional buf errorp)
@@ -183,13 +193,22 @@ evaluating (realgud-cmdbuf-info-loc-regexp 
realgud-cmdbuf-info)"
   (interactive "r")
   (if (> from to) (psetq to from from to))
   (let* ((text (buffer-substring-no-properties from to))
-        (loc (realgud-track-loc text cmd-mark))
+        (cmdbuf (or opt-cmdbuf (current-buffer)))
+        (loc-regexp (realgud-sget 'cmdbuf-info 'loc-regexp))
+        (file-group (realgud-sget 'cmdbuf-info 'file-group))
+        (line-group (realgud-sget 'cmdbuf-info 'line-group))
+        (column-group (realgud-sget 'cmdbuf-info 'column-group))
+        (alt-file-group (realgud-sget 'cmdbuf-info 'alt-file-group))
+        (alt-line-group (realgud-sget 'cmdbuf-info 'alt-line-group))
+        (text-group (realgud-sget 'cmdbuf-info 'text-group))
+        (loc (realgud-track-loc text cmd-mark loc-regexp file-group
+                                line-group column-group text-group
+                                ))
         ;; If we see a selected frame number, it is stored
         ;; in frame-num. Otherwise, nil.
         (frame-num)
         (text-sans-loc)
         (bp-loc)
-        (cmdbuf (or opt-cmdbuf (current-buffer)))
         )
     (unless (realgud:track-complain-if-not-in-cmd-buffer cmdbuf t)
        (if (not (equal "" text))
@@ -374,9 +393,10 @@ encountering a new loc."
        ))
   )
 
-(defun realgud-track-loc(text cmd-mark &optional opt-regexp opt-file-group
-                          opt-line-group no-warn-on-no-match?
-                          opt-ignore-file-re)
+(defun realgud-track-loc(text cmd-mark loc-regexp file-group
+                             line-group column-group text-group
+                             &optional no-warn-on-no-match?
+                             opt-ignore-file-re)
   "Do regular-expression matching to find a file name and line number inside
 string TEXT. If we match, we will turn the result into a realgud-loc struct.
 Otherwise return nil."
@@ -391,15 +411,8 @@ Otherwise return nil."
 
   (unless (realgud:track-complain-if-not-in-cmd-buffer)
       (let
-         ((loc-regexp (or opt-regexp
-                          (realgud-sget 'cmdbuf-info 'loc-regexp)))
-          (file-group (or opt-file-group
-                          (realgud-sget 'cmdbuf-info 'file-group)))
-          (line-group (or opt-line-group
-                          (realgud-sget 'cmdbuf-info 'line-group)))
-          (alt-file-group (realgud-sget 'cmdbuf-info 'alt-file-group))
+         ((alt-file-group (realgud-sget 'cmdbuf-info 'alt-file-group))
           (alt-line-group (realgud-sget 'cmdbuf-info 'alt-line-group))
-          (text-group (realgud-sget 'cmdbuf-info 'text-group))
           (ignore-file-re (or opt-ignore-file-re
                               (realgud-sget 'cmdbuf-info 'ignore-file-re)))
           (callback-loc-fn (realgud-sget 'cmdbuf-info 'callback-loc-fn))
@@ -410,9 +423,13 @@ Otherwise return nil."
                                     (match-string alt-file-group text)))
                       (line-str (or (match-string line-group text)
                                     (match-string alt-line-group text)))
+                      (column-str
+                       (cond (column-group (match-string column-group text))
+                             ('t "1")))
                       (source-str (and text-group
                                        (match-string text-group text)))
                       (lineno (string-to-number (or line-str "1")))
+                      (column (string-to-number (or column-str "1")))
                       (directory
                        (cond ((boundp 'starting-directory) starting-directory)
                                     (t nil)))
@@ -422,13 +439,13 @@ Otherwise return nil."
                                      source-str)))
                  (cond (callback-loc-fn
                         (funcall callback-loc-fn text
-                                 filename lineno source-str
+                                 filename lineno column source-str
                                  ignore-file-re cmd-mark))
                        ('t
                         (unless line-str
                           (message "line number not found -- using 1"))
                         (if (and filename lineno)
-                            (realgud:file-loc-from-line filename lineno
+                            (realgud:file-loc-from-line filename lineno column
                                                         cmd-mark
                                                         source-str nil
                                                         ignore-file-re
@@ -466,6 +483,7 @@ Otherwise return nil. CMD-MARK is set in the realgud-loc 
object created.
                    (loc-regexp     (realgud-loc-pat-regexp loc-pat))
                    (file-group     (realgud-loc-pat-file-group loc-pat))
                    (line-group     (realgud-loc-pat-line-group loc-pat))
+                   (col-group      (realgud-loc-pat-column-group loc-pat))
                    (text-group     (realgud-loc-pat-text-group loc-pat))
                    (ignore-file-re (realgud-loc-pat-ignore-file-re loc-pat))
                    (callback-loc-fn (realgud-sget 'cmdbuf-info 
'callback-loc-fn))
@@ -716,6 +734,8 @@ find a location. non-nil if we can find a location.
                                (realgud-loc-pat-regexp loc-pat)
                                (realgud-loc-pat-file-group loc-pat)
                                (realgud-loc-pat-line-group loc-pat)
+                               (realgud-loc-pat-column-group loc-pat)
+                               (realgud-loc-pat-text-group loc-pat)
                                nil
                                (realgud-loc-pat-ignore-file-re loc-pat)
                                ))
diff --git a/realgud/debugger/gdb/init.el b/realgud/debugger/gdb/init.el
index 92bb5d6..4fa1c81 100644
--- a/realgud/debugger/gdb/init.el
+++ b/realgud/debugger/gdb/init.el
@@ -45,7 +45,7 @@ realgud-loc-pat struct")
                       realgud:gdb-frame-file-regexp 
realgud:regexp-captured-num)
        :file-group 1
        :line-group 2
-       :char-offset-group 3))
+       :column-group 3))
 
 ;; Regular expression that describes a gdb prompt
 ;; For example:
diff --git a/realgud/debugger/gub/init.el b/realgud/debugger/gub/init.el
index f244267..5b7bf93 100644
--- a/realgud/debugger/gub/init.el
+++ b/realgud/debugger/gub/init.el
@@ -81,7 +81,7 @@ realgud-loc-pat struct")
        :num 1
        :file-group 2
        :line-group 3
-       :char-offset-group 4))
+       :column-group 4))
 
 ;; Regular expression that describes a debugger "delete" (breakpoint) response.
 ;; For example:
diff --git a/realgud/debugger/jdb/core.el b/realgud/debugger/jdb/core.el
index 34064e1..5f927cb 100644
--- a/realgud/debugger/jdb/core.el
+++ b/realgud/debugger/jdb/core.el
@@ -97,10 +97,10 @@ that works."
      ))
   )
 
-(defun realgud:jdb-loc-fn-callback(text filename lineno source-str
+(defun realgud:jdb-loc-fn-callback(text filename lineno column source-str
                                        ignore-file-re cmd-mark)
-  (realgud:file-loc-from-line filename lineno
-                             cmd-mark source-str nil
+  (realgud:file-loc-from-line filename lineno nil
+                             cmd-mark source-str column
                              ignore-file-re 'realgud:jdb-find-file))
 
 (defun realgud:jdb-parse-cmd-args (orig-args)
diff --git a/realgud/debugger/nodejs/init.el b/realgud/debugger/nodejs/init.el
index 70634af..a009e47 100644
--- a/realgud/debugger/nodejs/init.el
+++ b/realgud/debugger/nodejs/init.el
@@ -109,7 +109,7 @@ realgud-loc-pat struct")
        :num 1
        :file-group 2
        :line-group 3
-       :char-offset-group 4))
+       :column-group 4))
 
 (defconst realgud:nodejs-debugger-name "nodejs" "Name of debugger")
 
diff --git a/realgud/debugger/trepan/core.el b/realgud/debugger/trepan/core.el
index a844208..93bd402 100644
--- a/realgud/debugger/trepan/core.el
+++ b/realgud/debugger/trepan/core.el
@@ -76,9 +76,9 @@ future, we may also consult RUBYPATH."
       ))
     ))
 
-(defun realgud:trepan-loc-fn-callback(text filename lineno source-str
+(defun realgud:trepan-loc-fn-callback(text filename lineno column source-str
                                           ignore-file-re cmd-mark)
-  (realgud:file-loc-from-line filename lineno
+  (realgud:file-loc-from-line filename lineno column
                              cmd-mark source-str nil nil
                              'realgud:trepan-find-file))
 
diff --git a/realgud/debugger/trepan2/core.el b/realgud/debugger/trepan2/core.el
index ddf9011..2c2c282 100644
--- a/realgud/debugger/trepan2/core.el
+++ b/realgud/debugger/trepan2/core.el
@@ -85,9 +85,9 @@ we may also consult PYTHONPATH."
       ))
     ))
 
-(defun realgud:trepan2-loc-fn-callback(text filename lineno source-str
+(defun realgud:trepan2-loc-fn-callback(text filename lineno column source-str
                                            ignore-file-re cmd-mark)
-  (realgud:file-loc-from-line filename lineno
+  (realgud:file-loc-from-line filename lineno column
                              cmd-mark source-str nil nil
                              'realgud:trepan2-find-file))
 
diff --git a/realgud/debugger/trepanjs/init.el 
b/realgud/debugger/trepanjs/init.el
index 9f37b6f..70053b5 100644
--- a/realgud/debugger/trepanjs/init.el
+++ b/realgud/debugger/trepanjs/init.el
@@ -48,7 +48,7 @@ realgud-loc-pat struct")
                realgud:regexp-captured-num)
        :file-group 1
        :line-group 2
-       :char-offset-group 3
+       :column-group 3
        ))
 
 ;; realgud-loc-pat that describes a trepanjs command prompt
@@ -123,7 +123,7 @@ realgud-loc-pat struct")
        :num 1
        :file-group 2
        :line-group 3
-       :char-offset-group 4
+       :column-group 4
        ))
 
 (defconst realgud:trepanjs-debugger-name "trepanjs" "Name of debugger")
diff --git a/realgud/lang/js.el b/realgud/lang/js.el
index 8d19847..8cc8f16 100644
--- a/realgud/lang/js.el
+++ b/realgud/lang/js.el
@@ -35,7 +35,7 @@
                   realgud:regexp-captured-num realgud:regexp-captured-num)
    :file-group 2
    :line-group 3
-   :char-offset-group 4)
+   :column-group 4)
   "A realgud-loc-pat struct that describes a V8 backtrace location")
 
 (provide-me "realgud-lang-")
diff --git a/realgud/lang/python.el b/realgud/lang/python.el
index 2f41136..47b2c27 100644
--- a/realgud/lang/python.el
+++ b/realgud/lang/python.el
@@ -176,10 +176,11 @@ traceback) line."  )
 
 (defconst realgud-flake8-msg-loc-pat
   (make-realgud-loc-pat
-   :regexp "^\\(.*\\):\\([0-9]+\\):\\([0-9]+\\): [EW]\\([0-9]+\\) "
+   :regexp "^\\(.*\\):\\([0-9]+\\):\\([0-9]+\\): [EFWCN]\\([0-9]+\\) "
    :file-group 1
    :line-group 2
-   :char-offset-group 3
+   :column-group 3
+   :text-group nil
    )
   "A realgud-loc-pat struct that describes a flake8 warning or error line"
   )
diff --git a/test/test-file.el b/test/test-file.el
index e9129d4..3164624 100644
--- a/test/test-file.el
+++ b/test/test-file.el
@@ -68,12 +68,12 @@
   (assert-t (stringp (realgud:file-loc-from-line test-filename 10001))
            "Line number too large for file")
 
-  (setq test-file-loc (realgud:file-loc-from-line (__FILE__) 5 nil ";; Note"))
+  (setq test-file-loc (realgud:file-loc-from-line (__FILE__) 5 nil nil ";; 
Note"))
   (assert-t (realgud-loc? test-file-loc)
            "Ok loc creation - no cmd marker")
 
   (assert-t (realgud-loc?
-            (realgud:file-loc-from-line test-filename 30 (make-marker)))
+            (realgud:file-loc-from-line test-filename 30 nil (make-marker)))
            "Ok loc creation - cmd marker")
 
   (assert-equal 5 (realgud-loc-line-number test-file-loc))
diff --git a/test/test-loc-regexp-nodejs.el b/test/test-loc-regexp-nodejs.el
index f9b647d..b93094f 100644
--- a/test/test-loc-regexp-nodejs.el
+++ b/test/test-loc-regexp-nodejs.el
@@ -20,7 +20,7 @@
 (declare-function assert-equal 'test-simple)
 (declare-function note 'test-simple)
 (declare-function end-tests 'test-simple)
-(declare-function realgud-loc-pat-char-offset-group  'realgud:nodejs-init)
+(declare-function realgud-loc-pat-column-group  'realgud:nodejs-init)
 
 (test-simple-start)
 
@@ -68,7 +68,7 @@
 (setq num-group (realgud-loc-pat-num realgud-pat-bt))
 (setq file-group (realgud-loc-pat-file-group realgud-pat-bt))
 (setq line-group (realgud-loc-pat-line-group realgud-pat-bt))
-(setq col-group (realgud-loc-pat-char-offset-group realgud-pat-bt))
+(setq col-group (realgud-loc-pat-column-group realgud-pat-bt))
 (assert-equal 0 (string-match bt-re test-s1))
 (assert-equal "0" (substring test-s1
                             (match-beginning num-group)
diff --git a/test/test-regexp-gub.el b/test/test-regexp-gub.el
index 0240a05..faf87ac 100644
--- a/test/test-regexp-gub.el
+++ b/test/test-regexp-gub.el
@@ -12,11 +12,13 @@
 
 (eval-when-compile
   (defvar dbg-name)
-  (defvar realgud:gub-pat-hash)
   (defvar panic-tb)
-  (defvar test-tb)
+  (defvar prompt-match)
   (defvar prompt-pat)
+  (defvar realgud:gub-pat-hash)
+  (defvar tb-loc-match)
   (defvar test-dbgr)
+  (defvar test-tb)
   (defvar test-text)
 )
 
diff --git a/test/test-regexp-python.el b/test/test-regexp-python.el
index 35301c2..2471d2b 100644
--- a/test/test-regexp-python.el
+++ b/test/test-regexp-python.el
@@ -35,7 +35,7 @@
                            test-text))
 
 (assert-equal "17"
-             (match-string (realgud-loc-pat-char-offset-group 
realgud-flake8-msg-loc-pat)
+             (match-string (realgud-loc-pat-column-group 
realgud-flake8-msg-loc-pat)
                            test-text))
 
 (setq test-text
@@ -54,7 +54,7 @@
                            test-text))
 
 (assert-equal "1"
-             (match-string (realgud-loc-pat-char-offset-group 
realgud-flake8-msg-loc-pat)
+             (match-string (realgud-loc-pat-column-group 
realgud-flake8-msg-loc-pat)
                            test-text))
 
 ;; FIXME add pytest testing
diff --git a/test/test-regexp-rdebug.el b/test/test-regexp-rdebug.el
index c57dc23..8eb535b 100644
--- a/test/test-regexp-rdebug.el
+++ b/test/test-regexp-rdebug.el
@@ -10,6 +10,10 @@
 (test-simple-start)
 
 (eval-when-compile
+  (defvar helper-bps)
+  (defvar helper-bt)
+  (defvar prompt-pat)
+  (defvar rails-bt)
   (defvar realgud-rdebug-pat-hash)
 )
 
diff --git a/test/test-regexp-trepan.el b/test/test-regexp-trepan.el
index bff0331..5be508a 100644
--- a/test/test-regexp-trepan.el
+++ b/test/test-regexp-trepan.el
@@ -7,6 +7,20 @@
 
 (test-simple-start)
 
+(eval-when-compile
+  (defvar bps-pat)
+  (defvar dbg-bt-pat)
+  (defvar ctrl-pat)
+  (defvar file-group)
+  (defvar line-group)
+  (defvar prompt-pat)
+  (defvar lang-bt-pat)
+  (defvar tb-loc-match)
+  (defvar test-dbgr)
+  (defvar test-s1)
+  (defvar test-text)
+)
+
 (set (make-local-variable 'bps-pat)
      (gethash "brkpt-set"          realgud:trepan-pat-hash))
 (set (make-local-variable 'dbg-bt-pat)
@@ -21,26 +35,26 @@
 ;; FIXME: we get a void variable somewhere in here when running
 ;;        even though we define it in lexical-let. Dunno why.
 ;;        setq however will workaround this.
-(set (make-local-variable 'text)
+(set (make-local-variable 'test-text)
  "     from /usr/local/bin/irb:12:in `<main>'")
 
 (note "traceback location matching")
 
-(setq text "   from /usr/local/bin/irb:12:in `<main>'")
+(setq test-text "      from /usr/local/bin/irb:12:in `<main>'")
 
-(assert-t (numberp (loc-match text lang-bt-pat))
+(assert-t (numberp (loc-match test-text lang-bt-pat))
          "basic traceback location")
 (assert-equal "/usr/local/bin/irb"
-             (match-string (realgud-loc-pat-file-group lang-bt-pat) text)
+             (match-string (realgud-loc-pat-file-group lang-bt-pat) test-text)
              "extract traceback file name")
 
 (assert-equal "12"
              (match-string (realgud-loc-pat-line-group
-                            lang-bt-pat) text)
+                            lang-bt-pat) test-text)
              "extract traceback line number")
 
 (note "debugger-backtrace")
-(set (make-local-variable 's1)
+(set (make-local-variable 'test-s1)
      "--> #0 METHOD Object#require(path) in file <internal:lib/require> at 
line 28
     #1 TOP Object#<top /tmp/linecache.rb> in file /tmp/linecache.rb
 ")
@@ -54,26 +68,26 @@
 (set (make-local-variable 'line-group)
      (realgud-loc-pat-line-group dbg-bt-pat))
 
-(assert-equal 0 (string-match frame-re s1))
-(assert-equal "0" (substring s1
+(assert-equal 0 (string-match frame-re test-s1))
+(assert-equal "0" (substring test-s1
                             (match-beginning num-group)
                             (match-end num-group)))
 (assert-equal "<internal:lib/require>"
-             (substring s1
+             (substring test-s1
                         (match-beginning file-group)
                         (match-end file-group)))
 (assert-equal "28"
-             (substring s1
+             (substring test-s1
                         (match-beginning line-group)
                         (match-end line-group)))
 (setq pos (match-end 0))
 
-(assert-equal 77 (string-match frame-re s1 pos))
-(assert-equal "1" (substring s1
+(assert-equal 77 (string-match frame-re test-s1 pos))
+(assert-equal "1" (substring test-s1
                             (match-beginning num-group)
                             (match-end num-group)))
 (assert-equal "/tmp/linecache.rb"
-             (substring s1
+             (substring test-s1
                         (match-beginning file-group)
                         (match-end file-group)))
 
@@ -102,23 +116,24 @@
                 ctrl-pat)
              )
 
-(setq text "Breakpoint 1 set at VM offset 2 of instruction sequence \"<top 
/usr/local/bin/irb>\",
+(setq test-text
+      "Breakpoint 1 set at VM offset 2 of instruction sequence \"<top 
/usr/local/bin/irb>\",
        line 9 in file /usr/local/bin/irb.
 ")
 
 
-(assert-t (numberp (loc-match text bps-pat))
+(assert-t (numberp (loc-match test-text bps-pat))
          "basic breakpoint location")
 
 
 (assert-equal "/usr/local/bin/irb"
              (match-string (realgud-loc-pat-file-group
-                            bps-pat) text)
+                            bps-pat) test-text)
              "extract breakpoint file name")
 
 (assert-equal "9"
              (match-string (realgud-loc-pat-line-group
-                            bps-pat) text)
+                            bps-pat) test-text)
              "extract breakpoint line number")
 
 (end-tests)
diff --git a/test/test-track.el b/test/test-track.el
index 5e98fec..d167cb8 100644
--- a/test/test-track.el
+++ b/test/test-track.el
@@ -24,10 +24,18 @@
 (test-simple-start)
 
 (eval-when-compile
+  (defvar alt-file-group)
+  (defvar alt-line-group)
+  (defvar column-group)
   (defvar debugger-output)
+  (defvar file-group)
+  (defvar line-group)
   (defvar line-number)
+  (defvar loc-regexp)
   (defvar realgud-pat-hash)
   (defvar test-filename)
+  (defvar test-loc)
+  (defvar text-group)
 )
 
 ;; Some setup usually done in setting up the buffer.
@@ -37,22 +45,34 @@
 
 ;; FIXME/WARNING the below is customized for trepan
 (realgud-cmdbuf-init (current-buffer) "trepan"
-                 (gethash "trepan" realgud-pat-hash))
+                    (gethash "trepan" realgud-pat-hash))
+
+(setq loc-regexp (realgud-sget 'cmdbuf-info 'loc-regexp))
+(setq file-group (realgud-sget 'cmdbuf-info 'file-group))
+(setq line-group (realgud-sget 'cmdbuf-info 'line-group))
+(setq column-group (realgud-sget 'cmdbuf-info 'column-group))
+(setq alt-file-group (realgud-sget 'cmdbuf-info 'alt-file-group))
+(setq alt-line-group (realgud-sget 'cmdbuf-info 'alt-line-group))
+(setq text-group (realgud-sget 'cmdbuf-info 'text-group))
 
 (setq test-filename (symbol-file 'test-simple))
 (setq line-number 7)
 (setq debugger-output (format "-> (%s:%d)\nrequire 'foo'\n(trepan):\n"
                              test-filename line-number))
-(let ((loc (realgud-track-loc debugger-output nil)))
-  (assert-t (realgud-loc-p loc)   "loc extracted")
-  (assert-equal "(trepan):\n"
-               (realgud-track-loc-remaining debugger-output)
-               "loc-remaining")
-  (assert-equal test-filename (realgud-loc-filename loc)
-               "loc filename extracted")
-  (assert-equal line-number (realgud-loc-line-number loc)
-               "loc line-number extracted")
-  )
+(setq test-loc
+      (realgud-track-loc debugger-output nil
+                        loc-regexp file-group
+                        line-group column-group text-group
+                        ))
+
+(assert-t (realgud-loc-p test-loc)   "loc extracted")
+(assert-equal "(trepan):\n"
+             (realgud-track-loc-remaining debugger-output)
+             "loc-remaining")
+(assert-equal test-filename (realgud-loc-filename test-loc)
+             "loc filename extracted")
+(assert-equal line-number (realgud-loc-line-number test-loc)
+             "loc line-number extracted")
 
 (note "realgud-track-selected-frame")
 (setq debugger-output "up



reply via email to

[Prev in Thread] Current Thread [Next in Thread]